[Vtigercrm-commits] [Vtiger development] #7986: PATCH - getCVAdvFilterSQL gets 2+ filter groups wrong
    Vtiger development 
    vtiger-tickets at trac.vtiger.com
       
    Fri Mar 21 08:25:36 GMT 2014
    
    
  
#7986: PATCH - getCVAdvFilterSQL gets 2+ filter groups wrong
------------------------+------------------------
 Reporter:  autolive    |      Owner:  developer
     Type:  patch       |     Status:  new
 Priority:  unassigned  |  Milestone:  Unassigned
Component:  vtigercrm   |    Version:  5.4.0
 Severity:  Medium      |   Keywords:
------------------------+------------------------
 Hi,
 (you may want to read the patch first, it is 1 line of patch)
 The problem occurs when the advanced filter has 2 (or more) groups of
 conditions and when these 2+ groups have several conditions.
 The symptom is that the conditions of the 2+ group are not joined with any
 of [and|or] because the index of the the conditions of the 2+ group are
 not reset.
 In the 2nd group of condition, the $column index does not start at 0 but
 is a continued numbering from the previous condition group.
 for instance if you have this advanced filter:
 (condition1 or condition2) and (condition3 or condition4)
 this gets translated to sql into this:
 (condition1 or condition2) and (condition3condition4)
 because when processing group 2, the array of conditions is:
 [
 3 => condition3,
 4 => condition4
 ]
 and in the test (see patch) when processing the second group:
 count($groupcolumns) = 2
 $columnindex=3
 2 is not < to 3 so the $columncondition is not added
 The fix:
 max(array_keys()) is better then count() because it is all about comparing
 with the array_key [ => $columnindex ]
 The patch: see attached file
--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7986>
Vtiger development <http://trac.vtiger.com/>
Vtiger CRM
    
    
More information about the vtigercrm-commits
mailing list