Skip to content

Commit

Permalink
Merge pull request #13356 from yashodha/campaign_reports
Browse files Browse the repository at this point in the history
(dev/core#491) campaign cleanup for pledge detail report and show dis…
  • Loading branch information
seamuslee001 authored Dec 27, 2018
2 parents a08c43a + acbf6fc commit 3285129
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions CRM/Report/Form/Pledge/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ public function __construct() {
$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(
Expand Down Expand Up @@ -199,21 +191,7 @@ public function __construct() {
$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;
Expand Down Expand Up @@ -599,7 +577,7 @@ public function alterDisplay(&$rows) {
// 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;
}
Expand Down

0 comments on commit 3285129

Please sign in to comment.