<?php
-// $Id$
-
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
);
public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
- protected $_add2groupSupported = FALSE; function __construct() {
+ protected $_add2groupSupported = FALSE;
+
+ function __construct() {
$yearsInPast = 10;
$yearsInFuture = 1;
$date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
$date['minYear']++;
}
+ // 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(
array('title' => ts('Donor Name'),
'required' => TRUE,
),
- 'first_name' => array('title' => ts('First Name'),
+ 'first_name' => array(
+ 'title' => ts('First Name'),
),
- 'last_name' => array('title' => ts('Last Name'),
+ 'last_name' => array(
+ 'title' => ts('Last Name'),
+ ),
+ 'contact_type' =>
+ array(
+ 'title' => ts('Contact Type'),
+ ),
+ 'contact_sub_type' =>
+ array(
+ 'title' => ts('Contact SubType'),
),
),
'filters' =>
'options' => $optionYear,
'default' => date('Y'),
),
- 'financial_type_id' =>
- array( 'title' => ts( 'Financial Type' ),
+ 'financial_type_id' =>
+ array('title' => ts('Financial Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::financialType( )
+ 'options' => CRM_Contribute_PseudoConstant::financialType(),
),
'contribution_status_id' =>
array('title' => ts('Contribution Status'),
),
);
+ // If we have a campaign, build out the relevant elements
+ if ($campaignEnabled && !empty($this->activeCampaigns)) {
+ $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
+ 'default' => 'false',
+ );
+ $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => $this->activeCampaigns,
+ );
+ }
+
$this->_tagFilter = TRUE;
parent::__construct();
}
CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
);
- if ( ($fieldName == 'contribution_status_id' || $fieldName == 'financial_type_id') && !empty( $clause ) ) {
+ if (($fieldName == 'contribution_status_id' || $fieldName == 'financial_type_id') && !empty($clause)) {
$this->_statusClause .= " AND " . $clause;
}
}
$rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
$rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contribution Details for this Contact.");
}
+
+ // 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 = TRUE;
+ }
+ }
}
}
// Override "This Year" $op options
- static function getOperationPair($type = "string", $fieldName = NULL) {
+ function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'yid') {
return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting'));
}