删除 ListView 中的默认排序顺序并按 SuiteCRM 中的“登录用户”排序。
最佳答案
在 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'];
关于sugarcrm - 在 SuiteCRM 中按 'logged in user' 对订单 ListView 进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32451782/