Skip to content
Snippets Groups Projects
Commit be78fc2d authored by lobo's avatar lobo
Browse files

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
parent 2b579808
Branches
Tags
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment