public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
function __construct() {
- $config = CRM_Core_Config::singleton();
+
+ // 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(
),
) + $this->addAddressFields();
+ // If we have a campaign, build out the relevant elements
$this->_tagFilter = TRUE;
if ($campaignEnabled && !empty($this->activeCampaigns)) {
$this->_columns['civicrm_contribution']['fields']['campaign_id'] = array(
$entryFound = TRUE;
}
- // convert campaign_id to campaign title
+ // If using campaigns, convert campaign_id to campaign title
if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
if ($value = $row['civicrm_contribution_campaign_id']) {
$rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->activeCampaigns[$value];
}
$entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s) for this ') ? TRUE : $entryFound;
-
// skip looking further in rows, if first row itself doesn't
// have the column we need
if (!$entryFound) {
protected $_customGroupGroupBy = FALSE;
public $_drilldownReport = array('member/detail' => 'Link to Detail Report');
- function __construct() {
+ function __construct() {
+
// UI for selecting columns to appear in the report list
- // array conatining the columns, group_bys and filters build and provided to Form
+ // Array containing the columns, group_bys and filters build and provided to Form
+
+ // 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_membership' =>
),
);
$this->_tagFilter = TRUE;
+
+ // If we have a campaign, build out the relevant elements
+ if ($campaignEnabled && !empty($this->activeCampaigns)) {
+ $this->_columns['civicrm_membership']['fields']['campaign_id'] = array(
+ 'title' => 'Campaign',
+ 'default' => 'false',
+ );
+ $this->_columns['civicrm_membership']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => $this->activeCampaigns,
+ );
+ $this->_columns['civicrm_membership']['grouping']['campaign_id'] = 'contri-fields';
+ $this->_columns['civicrm_membership']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
+ }
+
+
$this->_groupFilter = TRUE;
$this->_currencyColumn = 'civicrm_contribution_currency';
parent::__construct();
$rows[$rowNum]['civicrm_membership_membership_type_id'] = '<b>SubTotal</b>';
$entryFound = TRUE;
}
+
+
+ // If using campaigns, 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];
+ }
+ $entryFound = TRUE;
+ }
// skip looking further in rows, if first row itself doesn't
// have the column we need