From: Seamus Lee Date: Wed, 29 Jan 2020 21:20:03 +0000 (+1100) Subject: [REF] Ensure that the from is correctly modified in both the main query and in the... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f14e76869f59fa59e42fe17dbe6e0a8b1f4dd3f4;p=civicrm-core.git [REF] Ensure that the from is correctly modified in both the main query and in the statistics section of the Contribute Summary Report --- diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index fe273cd31a..ab65d97d30 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -611,8 +611,14 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { $group = "\nGROUP BY {$this->_aliases['civicrm_contribution']}.currency"; $this->from('contribution'); + if ($softCredit) { + $this->from(); + } $this->customDataFrom(); + // Ensure that Extensions that modify the from statement in the sql also modify it in the statistics. + CRM_Utils_Hook::alterReportVar('sql', $this, $this); + $contriQuery = " COUNT({$this->_aliases['civicrm_contribution']}.total_amount ) as civicrm_contribution_total_amount_count, SUM({$this->_aliases['civicrm_contribution']}.total_amount ) as civicrm_contribution_total_amount_sum, @@ -621,8 +627,6 @@ ROUND(AVG({$this->_aliases['civicrm_contribution']}.total_amount), 2) as civicrm {$this->_from} {$this->_where}"; if ($softCredit) { - $this->from(); - $this->customDataFrom(); $select = " COUNT({$this->_aliases['civicrm_contribution_soft']}.amount ) as civicrm_contribution_soft_soft_amount_count, SUM({$this->_aliases['civicrm_contribution_soft']}.amount ) as civicrm_contribution_soft_soft_amount_sum,