*
* @return int
* Group ID (null if Group ID doesn't exist)
+ * @throws \CRM_Core_Exception
*/
private static function _getGid($name = 'label_format') {
if (!isset(self::$_gid[$name]) || !self::$_gid[$name]) {
self::$_gid[$name] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $name, 'id', 'name');
if (!self::$_gid[$name]) {
- CRM_Core_Error::fatal(ts('Label Format Option Group not found in database.'));
+ throw new CRM_Core_Exception(ts('Label Format Option Group not found in database.'));
}
}
return self::$_gid[$name];
*
* @return array
* (reference) List of Label Formats
+ * @throws \CRM_Core_Exception
*/
public static function addOrder(&$list, $returnURL) {
$filter = "option_group_id = " . self::_getGid();
*
* @return array
* (reference) label format list
+ * @throws \CRM_Core_Exception
*/
- public static function &getList($namesOnly = FALSE, $groupName = 'label_format') {
+ public static function getList($namesOnly = FALSE, $groupName = 'label_format') {
static $list = [];
if (self::_getGid($groupName)) {
// get saved label formats from Option Value table
*
* @return array
* Name/value pairs containing the default Label Format values.
+ * @throws \CRM_Core_Exception
*/
public static function &getDefaultValues($groupName = 'label_format') {
$params = ['is_active' => 1, 'is_default' => 1];
*
* @return array
* (reference) associative array of name/value pairs
+ * @throws \CRM_Core_Exception
*/
public static function &getLabelFormat($field, $val, $groupName = 'label_format') {
$params = ['is_active' => 1, $field => $val];
*
* @return array
* (reference) associative array of name/value pairs
+ * @throws \CRM_Core_Exception
*/
public static function &getByName($name) {
return self::getLabelFormat('name', $name);
*
* @return array
* (reference) associative array of name/value pairs
+ * @throws \CRM_Core_Exception
*/
public static function &getById($id, $groupName = 'label_format') {
return self::getLabelFormat('id', $id, $groupName);
* @param string $groupName
*
* @return CRM_Core_DAO_OptionValue
+ * @throws \CRM_Core_Exception
*/
public static function retrieve(&$params, &$values, $groupName = 'label_format') {
$optionValue = new CRM_Core_DAO_OptionValue();
* Id of the database record (null = new record).
* @param string $groupName
* Group name of the label format.
+ *
+ * @throws \CRM_Core_Exception
*/
public function saveLabelFormat(&$values, $id = NULL, $groupName = 'label_format') {
// get the Option Group ID for Label Formats (create one if it doesn't exist)
* ID of the label format to be deleted.
* @param string $groupName
* Group name.
+ *
+ * @throws \CRM_Core_Exception
*/
public static function del($id, $groupName) {
if ($id) {
}
}
}
- CRM_Core_Error::fatal(ts('Invalid value passed to delete function.'));
+ throw new CRM_Core_Exception(ts('Invalid value passed to delete function.'));
}
}