7) { throw new CRM_Core_Exception(ts('You can not pass a severity level higher than 7.')); } // If severity is now blank, you have an invalid severity string. if (is_null($params['ignore_severity'])) { throw new CRM_Core_Exception(ts('Invalid string passed as severity level.')); } // Set default domain when creating (or updating by name) if (empty($params['id']) && empty($params['domain_id'])) { $params['domain_id'] = CRM_Core_Config::domainID(); } // Enforce unique status pref names. Update if a duplicate name is found in the same domain. if (empty($params['id']) && !empty($params['name'])) { $statusPreference->domain_id = $params['domain_id']; $statusPreference->name = $params['name']; $statusPreference->find(TRUE); } $op = $statusPreference->id ? 'edit' : 'create'; CRM_Utils_Hook::pre($op, 'StatusPreference', $statusPreference->id, $params); $statusPreference->copyValues($params); $statusPreference->save(); CRM_Utils_Hook::post($op, 'StatusPreference', $statusPreference->id, $statusPreference); return $statusPreference; } }