Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.4.3, 4.4.4
-
Fix Version/s: 4.5
-
Component/s: Core CiviCRM
-
Labels:None
Description
The sql-queries to load the data for the change-log of a contact are built up with multiple checks for 'modified_contact_civireport.id' in the WHERE-Clause:
"WHERE ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND ( modified_contact_civireport.id = 202 ) AND (entity_log_civireport.log_action != 'Initialization')"
Each query got one more modified_contact_civireport.id-check then the previous one.
In CRM/Report/Form.php:1962 - storeWhereHavingClauseArray() this->_whereClauses will be extended by another $clause each time the where-method is called. And it seems to be called once per query.
I've wrote a patch, checking if $clause is already in this->_whereClauses before adding it.
Don't know if this solution reflects the inner logic of the code, but it seems to work.