Skip to content

Commit

Permalink
Merge pull request #17195 from eileenmcnaughton/act_report2
Browse files Browse the repository at this point in the history
[REF] Simplify determination of enabled components
  • Loading branch information
colemanw authored Apr 30, 2020
2 parents d467e32 + f0100b8 commit 2e0edd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 0 additions & 2 deletions CRM/Core/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
* $Id$
*
*/
class CRM_Core_Component {

Expand Down
18 changes: 7 additions & 11 deletions CRM/Report/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
class CRM_Report_Form_Activity extends CRM_Report_Form {
protected $_selectAliasesTotal = [];

protected $_customGroupExtends = [
'Activity',
];
protected $_customGroupExtends = ['Activity'];

protected $_nonDisplayFields = [];

Expand All @@ -38,6 +36,8 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {

/**
* Class constructor.
*
* @throws \CRM_Core_Exception
*/
public function __construct() {
// There could be multiple contacts. We not clear on which contact id to display.
Expand All @@ -46,14 +46,10 @@ public function __construct() {
// if navigated from count link of activity summary reports.
$this->_resetDateFilter = CRM_Utils_Request::retrieve('resetDateFilter', 'Boolean');

$config = CRM_Core_Config::singleton();
$campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
$caseEnabled = in_array("CiviCase", $config->enableComponents);
if ($campaignEnabled) {
$this->engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
}

$components = CRM_Core_Component::getEnabledComponents();
$campaignEnabled = !empty($components['CiviCampaign']);
$caseEnabled = !empty($components['CiviCase']);

foreach ($components as $componentName => $componentInfo) {
// CRM-19201: Add support for reporting CiviCampaign activities
// For CiviCase, "access all cases and activities" is required here
Expand Down Expand Up @@ -332,7 +328,7 @@ public function __construct() {
];
// If we have campaigns enabled, add those elements to both the fields, filters.
$this->addCampaignFields('civicrm_activity');

$this->engagementLevels = $campaignEnabled ? CRM_Campaign_PseudoConstant::engagementLevel() : [];
if (!empty($this->engagementLevels)) {
$this->_columns['civicrm_activity']['fields']['engagement_level'] = [
'title' => ts('Engagement Index'),
Expand Down

0 comments on commit 2e0edd7

Please sign in to comment.