Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(dev/core#491) campaign cleanup for pledge detail report and show dis… #13356

Merged
merged 1 commit into from
Dec 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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