[Vtigercrm-developers] Correctly sort ListView

PlaymaN Tepes sshhocckk at gmail.com
Wed May 6 13:51:07 GMT 2015


Hi,

I recommend if you want to sort your related list by the default_order_by
and default_sort_order, modify:

modules/Vtiger/models/RelationListView.php

after

$orderBy = $this->getForSql('orderby');
$sortOrder = $this->getForSql('sortorder');

add

if(empty($orderBy) && empty($sortOrder) && $relationModuleName != "Users"){

if(PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) {
                                $moduleFocus =
CRMEntity::getInstance($relationModuleName);

                                $orderBy = $moduleFocus->default_order_by;
                                $sortOrder =
$moduleFocus->default_sort_order;
                        }
                }

2014-09-17 22:01 GMT+02:00 Jonathan Sardo <sardoj at gmail.com>:

> Hi !
>
> This is a way to correctly sort a ListView according with the field *$default_order_by
>  *defined in the module class:
>
> Edit "/modules/Vtiger/models/ListView.php" and add the following code at
> the line 188, after $sortOrder = $this->getForSql('sortorder') :
>
>
>
>
>
>
> *if(empty($orderBy) && empty($sortOrder) && $moduleName != "Users"){
>  if(!empty($moduleFocus->default_order_by))   {      $orderBy =
> $moduleFocus->default_order_by;   }*
>
>
>
>
>
> *   if(!empty($moduleFocus->default_sort_order))   {      $sortOrder =
> $moduleFocus->default_sort_order;   }}*
>
> Regards,
>
> Jonathan SARDO
> [image: Images intégrées 5]
> Tél. 06 99 45 50 47
>
> _______________________________________________
> http://www.vtiger.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20150506/9fd331a1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 4223 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20150506/9fd331a1/attachment.png>


More information about the vtigercrm-developers mailing list