if (CRM_Core_DAO_AllCoreTables::isCoreTable($tableName)) {
// Bad idea. Prevent group creation because it might lead to a broken configuration.
- CRM_Core_Error::fatal(ts("Cannot create custom table because %1 is already a core table.", ['1' => $tableName]));
+ throw new CRM_Core_Exception(ts('Cannot create custom table because %1 is already a core table.', ['1' => $tableName]));
}
}
}
$value = NULL;
}
}
- elseif ($field['html_type'] == 'Select' ||
- ($field['html_type'] == 'Radio' &&
- $field['data_type'] != 'Boolean'
+ elseif ($field['html_type'] === 'Select' ||
+ ($field['html_type'] === 'Radio' &&
+ $field['data_type'] !== 'Boolean'
)
) {
$customOption = CRM_Core_BAO_CustomOption::getCustomOption($key, TRUE);
}
}
}
- elseif ($field['data_type'] == 'Date') {
+ elseif ($field['data_type'] === 'Date') {
$valid = CRM_Utils_Rule::date($value);
}
*
* @return bool
* false if it matches else true
+ *
+ * @throws \CRM_Core_Exception
*/
public static function checkCustomField($customFieldId, &$removeCustomFieldTypes) {
- $query = "SELECT cg.extends as extends
+ $query = 'SELECT cg.extends as extends
FROM civicrm_custom_group as cg, civicrm_custom_field as cf
WHERE cg.id = cf.custom_group_id
- AND cf.id =" .
+ AND cf.id =' .
CRM_Utils_Type::escape($customFieldId, 'Integer');
$extends = CRM_Core_DAO::singleValueQuery($query);
if (array_key_exists($table, $extendObjs)) {
return $extendObjs[$table];
}
- CRM_Core_Error::fatal();
+ throw new CRM_Core_Exception('Unknown error');
}
}
}
if (isset($properties['customValue'][$groupCount])) {
$properties['element_name'] = "custom_{$k}_{$properties['customValue'][$groupCount]['id']}";
$formattedGroupTree[$key]['table_id'] = $properties['customValue'][$groupCount]['id'];
- if ($properties['data_type'] == 'File') {
+ if ($properties['data_type'] === 'File') {
$properties['element_value'] = $properties['customValue'][$groupCount];
$uploadNames[] = $properties['element_name'];
}
}
if (!is_array($args)) {
- CRM_Core_Error::fatal('Arg is not of type array');
+ throw new CRM_Core_Exception('Arg is not of type array');
}
list($className) = explode('::', $callback);