[Vtigercrm-developers] BUG: UI10 with more than 1 target breaking filters...?

Alan Lord alanslists at gmail.com
Thu May 21 15:41:20 GMT 2015


I think I have found a nasty bug in vtiger filters in 6.2.0

I have a custom module "LSMeters" which has a UI10 configured to point 
to either an Account or a Lead with the usual:

$field->setRelatedModules(Array('Accounts', 'Leads'));

Most of the time this is completely fine.

I created a new filter for my Meter List View which has two conditions 
in the "or" section;

The first being field equals the name of one of the Accounts and the 
second being "is empty"... So the idea is I get a list of Meters that 
are either related to one Account or not related to anything.

This however causes the query to break...

> Thu May 21 15:37:06 2015,827 [10328] INFO VT - PearDatabase ->ADODB error  Query Failed:SELECT ls_meters.esi_id, ls_meters.acclead_id, ls_meters.utility, ls_meters.rep, vtiger_crmentity.smownerid, ls_meters.lsmetersid FROM ls_meters  INNER JOIN vtiger_crmentity ON ls_
> meters.lsmetersid = vtiger_crmentity.crmid LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id LEFT JOIN vtiger_groups ON vtiger_crmentity.smownerid = vtiger_groups.groupid LEFT JOIN vtiger_leaddetails vtiger_leaddetailsacclead_id  ON ls_meters.accl
> ead_id = vtiger_leaddetailsacclead_id.leadid LEFT JOIN vtiger_account vtiger_accountacclead_id  ON ls_meters.acclead_id = vtiger_accountacclead_id.accountid  WHERE vtiger_crmentity.deleted=0 AND   (  (( trim(CONCAT()) = 'PALACE CLEANERS' OR trim(vtiger_accountacclead_
> id.accountname) = 'PALACE CLEANERS')  or ( ls_meters.acclead_id IS NULL OR ls_meters.acclead_id = '' OR ls_meters.acclead_id = '0') )) ORDER BY modifiedtime DESC LIMIT 0,21::->[1582]Incorrect parameter count in the call to native function 'CONCAT'

Notice the empty trim(CONCAT()).

The CONCAT is coming from the getSqlForNameInDisplayFormat function in 
vtlib/Vtiger/Deprecated.php

This function is being passed the following arguments after being called 
from the QueryGenerator:

> In Vtiger_Deprecated getSqlForNameInDisplayFormat
> Fucntion Args:
> (
>     [0] => Array
>         (
>             [first_name] => vtiger_leaddetailsacclead_id.firstname
>             [last_name] => vtiger_leaddetailsacclead_id.lastname
>         )
>
>     [1] => Users
>     [2] =>
> )


Can one of the devs suggest the right place to fix this? Looking at the 
code in the QueryGenerator for any length of time tends to make my head 
hurt ;-)

TIA

Al




More information about the vtigercrm-developers mailing list