diff --git a/modules/Vtiger/models/ListView.php b/modules/Vtiger/models/ListView.php index 0b0c1c087dc5f21b281879fae7fd6f5f1d3abb19..aaa6028f73b2811b53a788ce482c49181437b39c 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 32b3a95ff3f637e165d089237f78ec9b9ad85268..30256a61f265cb15dbb34413fe96afa569913375 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 +}