2

删除列表视图中的默认排序顺序,并在 SuiteCRM 中按“登录用户”排序。

4

2 回答 2

3

在 custom/modules/Prospects(your module)/views/view.list.php 中添加以下代码

 function listViewProcess() {

    global $current_user; 
    $user_name = $current_user->user_name;
    $id = $current_user->id;
    $this->processSearchForm();

        $this->params['custom_order_by'] = ' ORDER BY FIELD(assigned_user_id, "'.$id.'") DESC';
        $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
        $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
        echo $this->lv->display();
} 

custom_order_by 将被视为按字段排序,因此请声明

$ret_array['order_by']=''; 在 include/ListView/ListViewData.php

$main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['inner_join']. $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by'];
于 2015-09-08T08:40:55.897 回答
0

无需自定义 include/listView/ListViewDate.php 中的代码,只需在 custom/modules/(your module)/views/view.list.php 中添加以下代码

    function listViewProcess() {

            global $current_user; 
            $user_name = $current_user->user_name;
            $id = $current_user->id;
            $this->processSearchForm();
                $this->params['overrideOrder']='1';
                $this->params['orderBy']='1';
                $this->params['custom_order_by'] = ' ORDER BY FIELD(accounts.assigned_user_id, "'.$id.'") DESC';
                $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
            $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
            echo $this->lv->display();
        }   
于 2015-10-26T04:47:23.660 回答