From: Coleman Watts Date: Tue, 17 Nov 2015 19:53:36 +0000 (-0500) Subject: Add pseudoconstant to StatusPreference X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0e1b333ff77ed61b3771c5dad40d38253690d271;p=civicrm-core.git Add pseudoconstant to StatusPreference Fix for failing StatusPreferenceTest - pseudoconstant is needed by api to validate input. --- diff --git a/CRM/Utils/Check.php b/CRM/Utils/Check.php index a7db9408ad..4aeba74f6f 100644 --- a/CRM/Utils/Check.php +++ b/CRM/Utils/Check.php @@ -38,7 +38,7 @@ class CRM_Utils_Check { * @var array * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md */ - public static $severityMap = array( + protected static $severityList = array( \Psr\Log\LogLevel::DEBUG, \Psr\Log\LogLevel::INFO, \Psr\Log\LogLevel::NOTICE, @@ -69,6 +69,13 @@ class CRM_Utils_Check { return self::$_singleton; } + /** + * @return array + */ + public static function getSeverityList() { + return self::$severityList; + } + /** * Execute "checkAll". * @@ -151,7 +158,7 @@ class CRM_Utils_Check { $severity = strtolower($severity); } - return ($reverse) ? self::$severityMap[$severity] : array_search($severity, self::$severityMap); + return ($reverse) ? self::$severityList[$severity] : array_search($severity, self::$severityList); } /** diff --git a/api/v3/System.php b/api/v3/System.php index 0a2f0a44a8..df173f47e9 100644 --- a/api/v3/System.php +++ b/api/v3/System.php @@ -112,13 +112,13 @@ function _civicrm_api3_system_check_spec(&$spec) { 'title' => 'Severity', 'description' => 'Psr\Log\LogLevel string', 'type' => CRM_Utils_Type::T_STRING, - 'options' => array_combine(CRM_Utils_Check::$severityMap, CRM_Utils_Check::$severityMap), + 'options' => array_combine(CRM_Utils_Check::getSeverityList(), CRM_Utils_Check::getSeverityList()), ); $spec['severity_id'] = array( 'title' => 'Severity ID', 'description' => 'Integer representation of Psr\Log\LogLevel', 'type' => CRM_Utils_Type::T_INT, - 'options' => CRM_Utils_Check::$severityMap, + 'options' => CRM_Utils_Check::getSeverityList(), ); $spec['is_visible'] = array( 'title' => 'is visible', diff --git a/xml/schema/Core/StatusPreference.xml b/xml/schema/Core/StatusPreference.xml index 7f670d3cb3..7e924e641a 100644 --- a/xml/schema/Core/StatusPreference.xml +++ b/xml/schema/Core/StatusPreference.xml @@ -69,6 +69,9 @@ Hush messages up to and including this severity. 1 4.7 + + CRM_Utils_Check::getSeverityList + prefs