From 9a8059cf5d83b996566862aa432ca31a5c0d49c6 Mon Sep 17 00:00:00 2001 From: Alan Bell <alanbell@ubuntu.com> Date: Fri, 19 Feb 2016 12:23:52 +0000 Subject: [PATCH] if the preference LISTVIEW_DEFAULT_SORTING is specified then use it for list views and related lists --- modules/Vtiger/models/ListView.php | 4 ++++ modules/Vtiger/models/RelationListView.php | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/Vtiger/models/ListView.php b/modules/Vtiger/models/ListView.php index 0b0c1c087..aaa6028f7 100644 --- a/modules/Vtiger/models/ListView.php +++ b/modules/Vtiger/models/ListView.php @@ -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)){ diff --git a/modules/Vtiger/models/RelationListView.php b/modules/Vtiger/models/RelationListView.php index 32b3a95ff..30256a61f 100644 --- a/modules/Vtiger/models/RelationListView.php +++ b/modules/Vtiger/models/RelationListView.php @@ -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 +} -- GitLab