From 3b1c6a4fa1b567ac12841da472d6c75de24d0adb Mon Sep 17 00:00:00 2001 From: yashodha Date: Wed, 2 Jan 2019 09:38:17 +0530 Subject: [PATCH] (dev/core#491) campaign cleanup for member detail report and show disabled campaigns as well. --- CRM/Report/Form/Member/Detail.php | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/CRM/Report/Form/Member/Detail.php b/CRM/Report/Form/Member/Detail.php index 2b540787fe..13a286ada4 100644 --- a/CRM/Report/Form/Member/Detail.php +++ b/CRM/Report/Form/Member/Detail.php @@ -62,16 +62,6 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form { * Class constructor. */ public function __construct() { - - // 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( 'dao' => 'CRM_Contact_DAO_Contact', @@ -253,21 +243,8 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form { $this->_groupFilter = TRUE; $this->_tagFilter = TRUE; - // If we have active campaigns add those elements to both the fields and filters - if ($campaignEnabled && !empty($this->activeCampaigns)) { - $this->_columns['civicrm_membership']['fields']['campaign_id'] = array( - 'title' => ts('Campaign'), - 'default' => 'false', - ); - $this->_columns['civicrm_membership']['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_membership']['order_bys']['campaign_id'] = array('title' => ts('Campaign')); - - } + // If we have campaigns enabled, add those elements to both the fields, filters and sorting + $this->addCampaignFields('civicrm_membership', FALSE, TRUE); $this->_currencyColumn = 'civicrm_contribution_currency'; parent::__construct(); @@ -389,7 +366,7 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form { // Convert campaign_id to campaign title if (array_key_exists('civicrm_membership_campaign_id', $row)) { if ($value = $row['civicrm_membership_campaign_id']) { - $rows[$rowNum]['civicrm_membership_campaign_id'] = $this->activeCampaigns[$value]; + $rows[$rowNum]['civicrm_membership_campaign_id'] = $this->campaigns[$value]; $entryFound = TRUE; } } -- 2.25.1