Skip to content

Commit

Permalink
Merge pull request #13376 from yashodha/campaign_report_clean
Browse files Browse the repository at this point in the history
(dev/core#491) campaign cleanup for participant listing report and sh…
  • Loading branch information
seamuslee001 authored Jan 1, 2019
2 parents 00aed17 + 58be4d6 commit 1055968
Showing 1 changed file with 3 additions and 27 deletions.
30 changes: 3 additions & 27 deletions CRM/Report/Form/Event/ParticipantListing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -398,22 +388,8 @@ public function __construct() {
// & 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();
Expand Down Expand Up @@ -769,7 +745,7 @@ public function alterDisplay(&$rows) {
}

// 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);
Expand Down

0 comments on commit 1055968

Please sign in to comment.