Mass edit with search condition bug
Introduce
If you want to edit few records with MassEdit with search parameters nothing happens. Log tell something like
PearDatabase ->ADODB error Query Failed:SELECT vtiger_potential.potentialname, vtiger_potential.related_to, vtiger_potential.potentialtype, vtiger_potential.sales_stage, vtiger_potential.nextstep, vtiger_potential.closingdate, vtiger_potential.leadsource, vtiger_potential.potentialid FROM vtiger_potential INNER JOIN vtiger_crmentity ON vtiger_potential.potentialid = vtiger_crmentity.crmid INNER JOIN vtiger_potentialscf ON vtiger_potential.potentialid = vtiger_potentialscf.potentialid LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id LEFT JOIN vtiger_groups ON vtiger_crmentity.smownerid = vtiger_groups.groupid WHERE vtiger_crmentity.deleted=0 AND ( (( vtiger_potentialscf.cf_1002 = 'Vaskelovo') and ( (trim(CONCAT(vtiger_users.first_name,' ',vtiger_users.last_name)) = 'MIK' or vtiger_groups.groupname = 'MIK')) and ( vtiger_potential.sales_stage = 'Prospecting' OR vtiger_potential.sales_stage = 'Negatiation' OR vtiger_potential.sales_stage = 'Proposal/Price Quote' OR vtiger_potential.sales_stage = 'Negotiation/Review' OR vtiger_potential.sales_stage = 'Agreement_in_client' OR vtiger_potential.sales_stage = 'payment_wayting' OR vtiger_potential.sales_stage = 'create_order' OR vtiger_potential.sales_stage = 'wait' OR vtiger_potential.sales_stage = 'mainline' OR vtiger_potential.sales_stage = 'Home' OR vtiger_potential.sales_stage = 'Сварка' OR vtiger_potential.sales_stage = 'payment_next_waiting' OR vtiger_potential.sales_stage = 'billing' OR vtiger_potential.sales_stage = 'execution_documents' OR vtiger_potential.sales_stage = 'Closed Won') )) (( vtiger_potential.leadsource = 'PRODUCE') ) AND vtiger_potential.potentialid > 0::->[1064]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(( vtiger_potential.leadsource = 'PRODUCE') ) AND vtiger_potential.' at line 1
Problem here - query generator did not put "and" in
... 'Closed Won') )) (( vtiger_potential ...
Steps to reproduce
- For Opportunities make filter with at least 1 condition (for example created = today)
- In ListView add search parameter for at least 1 column
- Select top checkbox, and then "Select all xx records"
- MassEdit. Change any dropdown value
- Go!
- Nothing changes
FIX
If I right, to take search parameters into account you should update vtigercrm/modules/CustomView/models/Record.php
Was
192 queryGenerator->parseAdvFilterList(transformedSearchParams);
Should be
192 queryGenerator->parseAdvFilterList(transformedSearchParams, "AND");