[Vtigercrm-developers] performance on blank uitype 10 in lists

Alan Bell alan.bell at libertus.co.uk
Thu Jan 22 13:03:06 GMT 2015


Hi all,

if you have a list of for example contacts, and you are showing a column 
that is a uitype 10 to the organisations then vtiger gathers up all the 
ids of the organisations and callsgetEntityName in 
include/utils/CommonUtils.php to grab all the names. If there are some 
blanks in the list then it calls it with $ids_list looking something 
like array('',4,6,144) so there is a string and a bunch of numbers. This 
means that when it does the SQL query it can't use the index.

If you modify getEntityName so that it first ensures that $ids_list is 
an array (this is important, it calls it with a single ID when saving a 
record) then removes blanks from the array then things get a little 
faster on large databases. My function looks like this:

function getEntityName($module, $ids_list, $compute=true) {
            if (!is_array($ids_list)) $ids_list = array($ids_list);
         $ids_list=array_filter($ids_list);//remove blanks, they won't 
have a label
         if ($compute) {
                    return 
Vtiger_Functions::computeCRMRecordLabels($module, $ids_list);
         } else {
                 return Vtiger_Functions::getCRMRecordLabels($module, 
$ids_list);
         }
}

Alan.


More information about the vtigercrm-developers mailing list