通过SuiteCRM中的“登录用户”对订单列表视图进行排序

时间:2015-09-08 07:31:40

标签: sugarcrm suitecrm

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

2 个答案:

答案 0 :(得分:3)

在custom / modules / Prospects(您的模块)/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将被视为按字段排序 所以声明

include / ListView / ListViewData.php

中的

$ret_array['order_by']='';

$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'];

答案 1 :(得分:0)

如果没有自定义include / listView / ListViewDate.php中的代码,只需在custom / modules /(您的模块)中添加以下代码/views/view.list.php

.stop()