CRM-16792 - Report: Contrib Summary when soft credit stats and filter applied
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Wed, 29 Jul 2015 07:02:30 +0000 (12:32 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Wed, 29 Jul 2015 07:02:30 +0000 (12:32 +0530)
CRM/Report/Form/Contribute/Summary.php

index 93d43faad879263bafba35b43ffafa61e24fd3b7..53a962b8b076a400439b32ada5fd93cf3dc10da1 100644 (file)
@@ -565,12 +565,13 @@ ROUND(AVG({$this->_aliases['civicrm_contribution']}.total_amount), 2) as civicrm
 
     if ($softCredit) {
       $this->from();
-      $softSQL = "SELECT
+      $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,
-ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_contribution_soft_soft_amount_avg,
-{$this->_aliases['civicrm_contribution']}.currency                    as currency
-{$this->_from} {$this->_where} {$group} {$this->_having}";
+ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_contribution_soft_soft_amount_avg";
+      $contriQuery = "{$select}, {$contriQuery}";
+      $softSQL = "SELECT {$select}, {$this->_aliases['civicrm_contribution']}.currency as currency
+      {$this->_from} {$this->_where} {$group} {$this->_having}";
     }
 
     $contriSQL = "SELECT {$contriQuery} {$group} {$this->_having}";