From: Dave Greenberg Date: Thu, 5 Sep 2013 16:12:46 +0000 (-0400) Subject: CRM-13346 add contribution page column and filter to contribution summary and detail... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0d0e945a8980a2bb79f32c3b88488c88332ed721;p=civicrm-core.git CRM-13346 add contribution page column and filter to contribution summary and detail report. ---------------------------------------- * CRM-13346: Add Contribution Page column and filter to Contribution Summary and Detail reports http://issues.civicrm.org/jira/browse/CRM-13346 --- diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index ec1693bf07..08bea47413 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -197,6 +197,8 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { ), 'contribution_status_id' => array('title' => ts('Contribution Status'), ), + 'contribution_page_id' => array('title' => ts('Contribution Page'), + ), 'source' => array('title' => ts('Source'), ), 'payment_instrument_id' => array('title' => ts('Payment Type'), @@ -249,6 +251,12 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { 'options' => CRM_Contribute_PseudoConstant::financialType(), 'type' => CRM_Utils_Type::T_INT, ), + 'contribution_page_id' => + array('title' => ts('Contribution Page'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::contributionPage(), + 'type' => CRM_Utils_Type::T_INT, + ), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, @@ -508,7 +516,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { $dao = CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { - $totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency)."(".$dao->count.")"; + $totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency)." (".$dao->count.")"; $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency); $count += $dao->count; } @@ -645,6 +653,7 @@ UNION ALL $contributionTypes = CRM_Contribute_PseudoConstant::financialType(); $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(); $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument(); + $contributionPages = CRM_Contribute_PseudoConstant::contributionPage(); $honorTypes = CRM_Core_OptionGroup::values('honor_type', FALSE, FALSE, FALSE, NULL, 'label'); @@ -717,6 +726,10 @@ UNION ALL $rows[$rowNum]['civicrm_contribution_contribution_status_id'] = $contributionStatus[$value]; $entryFound = TRUE; } + if ($value = CRM_Utils_Array::value('civicrm_contribution_contribution_page_id', $row)) { + $rows[$rowNum]['civicrm_contribution_contribution_page_id'] = $contributionPages[$value]; + $entryFound = TRUE; + } if ($value = CRM_Utils_Array::value('civicrm_contribution_payment_instrument_id', $row)) { $rows[$rowNum]['civicrm_contribution_payment_instrument_id'] = $paymentInstruments[$value]; $entryFound = TRUE; diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index 246e17c90b..a968fcbb3a 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -170,6 +170,12 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form { 'options' => CRM_Contribute_PseudoConstant::financialType(), 'type' => CRM_Utils_Type::T_INT, ), + 'contribution_page_id' => + array('title' => ts('Contribution Page'), + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => CRM_Contribute_PseudoConstant::contributionPage(), + 'type' => CRM_Utils_Type::T_INT, + ), 'total_amount' => array('title' => ts('Contribution Amount'), ), @@ -527,12 +533,12 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_ $totalAmount = $average = $softTotalAmount = $softAverage = array(); $count = $softCount = 0; while ($dao->fetch()) { - $totalAmount[] = CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_sum, $dao->currency)."(".$dao->civicrm_contribution_total_amount_count.")"; + $totalAmount[] = CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_sum, $dao->currency)." (".$dao->civicrm_contribution_total_amount_count.")"; $average[] = CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_avg, $dao->currency); $count += $dao->civicrm_contribution_total_amount_count; if ($softCredit) { - $softTotalAmount[] = CRM_Utils_Money::format($dao->civicrm_contribution_soft_soft_amount_sum, $dao->currency)."(".$dao->civicrm_contribution_soft_soft_amount_count.")"; + $softTotalAmount[] = CRM_Utils_Money::format($dao->civicrm_contribution_soft_soft_amount_sum, $dao->currency)." (".$dao->civicrm_contribution_soft_soft_amount_count.")"; $softAverage[] = CRM_Utils_Money::format($dao->civicrm_contribution_soft_soft_amount_avg, $dao->currency); $softCount += $dao->civicrm_contribution_soft_soft_amount_count; }