From: Bernardo Araujo Date: Mon, 19 Sep 2016 19:18:19 +0000 (-0300) Subject: changed from using a custom function to get the enabled components to use CRM_Core_Co... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=22e4d0990c32123d0d0e921938fdda6c5ea91892;p=civicrm-core.git changed from using a custom function to get the enabled components to use CRM_Core_Component::getEnabledComponents --- diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index 4c2446cba4..d58d102276 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -158,8 +158,13 @@ class CRM_Contact_Form_Search_Criteria { ); $componentModes = CRM_Contact_Form_Search::getModeSelect(); + $enabledComponents = CRM_Core_Component::getEnabledComponents(); - self::validatePossibleComponents($componentModes); + // unset disabled components that must should have been enabled + // to the option be viable + if (!array_key_exists('CiviMail', $enabledComponents)) { + unset($componentModes['8']); + } // unset contributions or participants if user does not have // permission on them @@ -541,19 +546,4 @@ class CRM_Contact_Form_Search_Criteria { CRM_Case_BAO_Query::buildSearchForm($form); } - public static function getEnabledComponents() { - $apiResult = civicrm_api3('Setting', 'Get', array()); - return $apiResult['values'][1]['enable_components']; - } - - //the idea is to validate everything in here and remove based on possible situations - public static function validatePossibleComponents(&$componentModes) { - $enabledComponents = self::getEnabledComponents(); - - //e.g. this validation that removes the 'Mailing' option if CiviMail is not enabled - if (!in_array('CiviMail', $enabledComponents)) { - unset($componentModes['8']); - } - } - }