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.')); } // Check if this StatusPreference already exists. if (empty($params['id']) && !empty($params['name'])) { $statusPreference->domain_id = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID()); $statusPreference->name = $params['name']; $statusPreference->find(TRUE); } $statusPreference->copyValues($params); $edit = (bool) $statusPreference->id; if ($edit) { CRM_Utils_Hook::pre('edit', 'StatusPreference', $statusPreference->id, $statusPreference); } else { CRM_Utils_Hook::pre('create', 'StatusPreference', NULL, $statusPreference); } $statusPreference->save(); if ($edit) { CRM_Utils_Hook::post('edit', 'StatusPreference', $statusPreference->id, $statusPreference); } else { CRM_Utils_Hook::post('create', 'StatusPreference', NULL, $statusPreference); } return $statusPreference; } }