From acbf6fcc8b9f76116b71d91917cc99b060c29850 Mon Sep 17 00:00:00 2001 From: yashodha Date: Thu, 27 Dec 2018 10:44:30 +0530 Subject: [PATCH] (dev/core#491) campaign cleanup for pledge detail report and show disabled campaigns as well --- CRM/Report/Form/Pledge/Detail.php | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/CRM/Report/Form/Pledge/Detail.php b/CRM/Report/Form/Pledge/Detail.php index e9d199c39b..a9cba5fc4e 100644 --- a/CRM/Report/Form/Pledge/Detail.php +++ b/CRM/Report/Form/Pledge/Detail.php @@ -71,14 +71,6 @@ class CRM_Report_Form_Pledge_Detail extends CRM_Report_Form { $this->_pledgeStatuses = CRM_Core_OptionGroup::values('pledge_status', FALSE, FALSE, FALSE, NULL, 'label' ); - // Check if CiviCampaign is a) enabled and b) has active campaigns - $config = CRM_Core_Config::singleton(); - $campaignEnabled = in_array("CiviCampaign", $config->enableComponents); - if ($campaignEnabled) { - $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE); - $this->activeCampaigns = $getCampaigns['campaigns']; - asort($this->activeCampaigns); - } $this->_columns = array( 'civicrm_contact' => array( @@ -199,21 +191,7 @@ class CRM_Report_Form_Pledge_Detail extends CRM_Report_Form { $this->_columns += $this->getAddressColumns(array('group_by' => FALSE)) + $this->getPhoneColumns(); // If we have a campaign, build out the relevant elements - $this->_tagFilter = TRUE; - if ($campaignEnabled && !empty($this->activeCampaigns)) { - $this->_columns['civicrm_pledge']['fields']['campaign_id'] = array( - 'title' => ts('Campaign'), - 'default' => 'false', - ); - $this->_columns['civicrm_pledge']['filters']['campaign_id'] = array( - 'title' => ts('Campaign'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => $this->activeCampaigns, - 'type' => CRM_Utils_Type::T_INT, - ); - $this->_columns['civicrm_pledge']['group_bys']['campaign_id'] = array('title' => ts('Campaign')); - - } + $this->addCampaignFields('civicrm_pledge', TRUE); $this->_groupFilter = TRUE; $this->_tagFilter = TRUE; @@ -599,7 +577,7 @@ class CRM_Report_Form_Pledge_Detail extends CRM_Report_Form { // If using campaigns, convert campaign_id to campaign title if (array_key_exists('civicrm_pledge_campaign_id', $row)) { if ($value = $row['civicrm_pledge_campaign_id']) { - $rows[$rowNum]['civicrm_pledge_campaign_id'] = $this->activeCampaigns[$value]; + $rows[$rowNum]['civicrm_pledge_campaign_id'] = $this->campaigns[$value]; } $entryFound = TRUE; } -- 2.25.1