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

Alan Bell alan.bell at libertus.co.uk
Fri Jan 23 10:02:00 GMT 2015


if I don't have that code, and I open the opportunities filter I get 
this in the mysql slow log:
SELECT firstname,lastname, contactid AS id FROM vtiger_contactdetails 
WHERE contactid IN ('',0);


Alan.

On 22/01/15 14:13, Prasad wrote:
> Alan,
>
> Elimination of blank ID seem to be already taken care. Any incidence 
> you found it is not?
>
> Refer: vtlib/Vtiger/Functions.php
> function getCRMRecordLabels > getCRMRecordMetadata($mixedid)
>
> --
> FB <http://www.facebook.com/vtiger> I Twit 
> <http://twitter.com/vtigercrm> I LIn 
> <https://www.linkedin.com/company/1270573?trk=tyah> I Blog 
> <https://blogs.vtiger.com> I Website <https://www.vtiger.com/>
>
> On Thu, Jan 22, 2015 at 6:33 PM, Alan Bell <alan.bell at libertus.co.uk 
> <mailto:alan.bell at libertus.co.uk>> wrote:
>
>     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.
>     _______________________________________________
>     http://www.vtiger.com/
>
>
>
>
> _______________________________________________
> http://www.vtiger.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20150123/5b4ebbaf/attachment.html>


More information about the vtigercrm-developers mailing list