X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=CRM%2FReport%2FForm%2FContribute%2FOrganizationSummary.php;h=28ad210763636cd9b600b1fcaf2fa399f11bd814;hb=e56bdf28a37560deeb61fba2a9f5d6629571a575;hp=4532a39fd0bb73b9c5f8cf17fcf4b75e92129d7f;hpb=52c503aac03bba16dff98f57d5647fb98168e9b7;p=civicrm-core.git diff --git a/CRM/Report/Form/Contribute/OrganizationSummary.php b/CRM/Report/Form/Contribute/OrganizationSummary.php index 4532a39fd0..28ad210763 100644 --- a/CRM/Report/Form/Contribute/OrganizationSummary.php +++ b/CRM/Report/Form/Contribute/OrganizationSummary.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2018 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2018 + * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { @@ -53,13 +53,6 @@ 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( @@ -212,18 +205,8 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { ), ); - 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(); @@ -521,22 +504,6 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { } } - // 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; @@ -575,11 +542,12 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form { // 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;