From 58be4d6ec547165ef1c70a3bf83751f3f9d07474 Mon Sep 17 00:00:00 2001 From: yashodha Date: Tue, 1 Jan 2019 21:55:28 +0530 Subject: [PATCH] (dev/core#491) campaign cleanup for participant listing report and show disabled campaigns as well. --- CRM/Report/Form/Event/ParticipantListing.php | 30 ++------------------ 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/CRM/Report/Form/Event/ParticipantListing.php b/CRM/Report/Form/Event/ParticipantListing.php index c4f78e6742..e429de20f5 100644 --- a/CRM/Report/Form/Event/ParticipantListing.php +++ b/CRM/Report/Form/Event/ParticipantListing.php @@ -38,7 +38,6 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event { protected $_groupFilter = TRUE; protected $_tagFilter = TRUE; protected $_balance = FALSE; - protected $activeCampaigns; protected $_customGroupExtends = array( 'Participant', @@ -55,15 +54,6 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event { public function __construct() { $this->_autoIncludeIndexedFieldsAsOrderBys = 1; - // 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', @@ -398,22 +388,8 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event { // & behaviour across reports but trying for no change at this point. $this->_columns['civicrm_contact']['fields']['sort_name']['no_display'] = TRUE; - // If we have active campaigns add those elements to both the fields and filters - if ($campaignEnabled && !empty($this->activeCampaigns)) { - $this->_columns['civicrm_participant']['fields']['campaign_id'] = array( - 'title' => ts('Campaign'), - 'default' => 'false', - ); - $this->_columns['civicrm_participant']['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_participant']['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_participant', FALSE, TRUE); $this->_currencyColumn = 'civicrm_participant_fee_currency'; parent::__construct(); @@ -769,7 +745,7 @@ ORDER BY cv.label } // Convert campaign_id to campaign title - $this->_initBasicRow($rows, $entryFound, $row, 'civicrm_participant_campaign_id', $rowNum, $this->activeCampaigns); + $this->_initBasicRow($rows, $entryFound, $row, 'civicrm_participant_campaign_id', $rowNum, $this->campaigns); // handle contribution status $this->_initBasicRow($rows, $entryFound, $row, 'civicrm_contribution_contribution_status_id', $rowNum, $contributionStatus); -- 2.25.1