+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form {
*/
public function __construct() {
self::validRelationships();
- $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_organization' => array(
),
);
- 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,
- 'type' => CRM_Utils_Type::T_INT,
- );
- }
+ // If we have a campaign, build out the relevant elements
+ $this->addCampaignFields('civicrm_contribution');
$this->_currencyColumn = 'civicrm_contribution_currency';
parent::__construct();
}
}
- // handle state province
- if (array_key_exists('civicrm_address_state_province_id', $row)) {
- if ($value = $row['civicrm_address_state_province_id']) {
- $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($value, FALSE);
- }
- $entryFound = TRUE;
- }
-
- // handle country
- if (array_key_exists('civicrm_address_country_id', $row)) {
- if ($value = $row['civicrm_address_country_id']) {
- $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value, FALSE);
- }
- $entryFound = TRUE;
- }
-
if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
$rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
$entryFound = TRUE;
// 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];
+ $rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->campaigns[$value];
$entryFound = TRUE;
}
}
+ $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, NULL, NULL) ? TRUE : $entryFound;
// skip looking further in rows, if first row itself doesn't
if (!$entryFound) {
break;