Сортировка списка заказов по "зарегистрированному пользователю" в SuiteCRM
Удаление порядка сортировки по умолчанию в виде списка и сортировка по "Авторизованному пользователю" в SuiteCRM.
2 ответа
Решение
Не настраивая код в include/listView/ListViewDate.php, просто добавьте следующий код в custom/modules/(ваш модуль)/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();
}
Добавьте следующий код в 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 будет рассматриваться как второй порядок по полю, поэтому объявите
$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'];