From be78fc2d9e84f913c81578fdfcb4b75db6a8aec0 Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Fri, 8 Nov 2013 12:07:22 -0800 Subject: [PATCH] CRM-13715 - fix bug when included in report columns ---------------------------------------- * CRM-13715: Add custom field column to Contribution Details report crashes http://issues.civicrm.org/jira/browse/CRM-13715 --- CRM/Report/Form/Contribute/Detail.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index 9afbc1db00..243fff34a2 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -419,7 +419,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { } } - function from($softcredit = false) { + function from($softcredit = FALSE) { $this->_from = " FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom} INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} @@ -496,6 +496,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { LEFT JOIN civicrm_batch {$this->_aliases['civicrm_batch']} ON {$this->_aliases['civicrm_batch']}.id = {$this->_aliases['civicrm_entity_batch']}.batch_id"; } + } function groupBy() { @@ -590,6 +591,10 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency"; // 2. customize main contribution query for soft credit, and build temp table 2 with soft credit contributions only $this->from(TRUE); + // also include custom group from if included + // since this might be included in select + $this->customDataFrom(); + $select = str_ireplace('contribution_civireport.total_amount', 'contribution_soft_civireport.amount', $this->_select); $select = str_ireplace("'Contribution' as", "'Soft Credit' as", $select); // we inner join with temp1 to restrict soft contributions to those in temp1 table @@ -606,6 +611,9 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency"; // simple reset of ->_from $this->from(); + + // also include custom group from if included + // since this might be included in select $this->customDataFrom(); // 3. Decide where to populate temp3 table from -- 2.25.1