}
}
+ $optionGroup = civicrm_api3('OptionGroup', 'get', array(
+ 'sequential' => 1,
+ 'name' => $self->_gName,
+ ));
+ $dataType = CRM_Core_BAO_OptionGroup::getDataType($optionGroup['id']);
+ if ($dataType) {
+ $validate = CRM_Utils_Type::validate($fields['value'], $dataType, FALSE);
+ if (!$validate) {
+ CRM_Core_Session::setStatus(
+ ts('Data Type of the value field for this option value does not match ' . $dataType),
+ ts('Value field Data Type mismatch'));
+ }
+ }
return $errors;
}
if (!empty($params['id'])) {
$ids = array('optionValue' => $params['id']);
}
- $dataType = CRM_Core_BAO_OptionGroup::getDataType($params['option_group_id']);
- if ($dataType) {
- $validate = CRM_Utils_Type::validate($params['value'], $dataType, FALSE);
- if(!$validate) {
- CRM_Core_Session::setStatus(
- ts('Data Type of the value field for this option value does not match ' . $dataType),
- ts('Value field Data Type mismatch'));
- }
- }
return CRM_Core_BAO_OptionValue::add($params, $ids);
}
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_act, {localize}'{ts escape="sql"}Close Accounting Period{/ts}'{/localize}, @option_group_id_act_val+1, 'Close Accounting Period', NULL, 0, 0, @option_group_id_act_wt+1, {localize}'Close Accounting Period'{/localize}, 0, 1, 1, 2, NULL);
+
+--CRM-
+ALTER TABLE civicrm_option_group
+ADD `data_type` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Data Type of Option Group.';
*/
public static function dataTypes() {
$types = array(
- 'integer',
+ 'Integer',
'String',
- 'date',
- 'time',
+ 'Date',
+ 'Time',
'Timestamp',
- 'money',
+ 'Money',
'Email',
);
return array_combine($types, $types);