Skip to content
Snippets Groups Projects
Commit 052885da authored by Prasad's avatar Prasad
Browse files

Merge branch 'fix_default_sort' into 'master'

Fix default sort ref #110

this adds code to the model for list views and related list views so that if no sort order is manually specified (someone hasn't clicked a column header) then it checks to see if the performance preference for default sorting is turned on and uses the sort order specified for the module. ref issue #110

See merge request !34
parents cb4323e5 9a8059cf
No related branches found
No related tags found
No related merge requests found
......@@ -189,6 +189,10 @@ class Vtiger_ListView_Model extends Vtiger_Base_Model {
if(empty($orderBy) && empty($sortOrder) && $moduleName != "Users"){
$orderBy = 'modifiedtime';
$sortOrder = 'DESC';
if (PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) {
$orderBy = $moduleFocus->default_order_by;
$sortOrder = $moduleFocus->default_sort_order;
}
}
if(!empty($orderBy)){
......
......@@ -213,6 +213,13 @@ class Vtiger_RelationListView_Model extends Vtiger_Base_Model {
$orderBy = $this->getForSql('orderby');
$sortOrder = $this->getForSql('sortorder');
if (!$orderBy & PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) {
$entityModule=CRMEntity::getInstance($relationModule->name);
$orderBy=$entityModule->default_order_by;
$sortorder=$entityModule->default_sort_order;
}
if($orderBy) {
$orderByFieldModuleModel = $relationModule->getFieldByColumn($orderBy);
......@@ -506,4 +513,4 @@ class Vtiger_RelationListView_Model extends Vtiger_Base_Model {
}
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment