*/
/**
- * This class contains functions for managing Action Logs
+ * This class contains functions for managing Status Preferences.
*/
class CRM_Core_BAO_StatusPreference extends CRM_Core_DAO_StatusPreference {
public static function create($params) {
$statusPreference = new CRM_Core_DAO_StatusPreference();
+ // Severity can be either text ('critical') or an integer <= 8.
+ if (!CRM_Utils_Rule::integer($params['minimum_report_severity'])) {
+ $params['minimum_report_severity'] = CRM_Utils_Check::severityMap($params['minimum_report_severity']);
+ }
+ CRM_Core_Error::debug('severity', $params['minimum_report_severity']);
+ if ($params['minimum_report_severity'] > 8) {
+ CRM_Core_Error::fatal(ts('You can not pass a severity level higher than 8 (Emergency).'));
+ }
+
+ // Check if this StatusPreference already exists.
if (empty($params['id']) && CRM_Utils_Array::value('name', $params)) {
$statusPreference->domain_id = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
$statusPreference->name = $params['name'];