Skip to content

Commit

Permalink
Fix saving option value with value=0
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed May 29, 2018
1 parent 0b0f516 commit 497e4c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public static function formRule($fields, $files, $self) {
$dataType = self::getOptionGroupDataType($self->_gName);
if ($dataType && $self->_gName !== 'activity_type') {
$validate = CRM_Utils_Type::validate($fields['value'], $dataType, FALSE);
if (!$validate) {
if ($validate === FALSE) {
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'));
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/OptionValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public static function addOptionValue(&$params, &$groupParams, &$action, &$optio
}
$params['option_group_id'] = $optionGroupID;

if (($action & CRM_Core_Action::ADD) && empty($params['value'])) {
if (($action & CRM_Core_Action::ADD) && !isset($params['value'])) {
$fieldValues = array('option_group_id' => $optionGroupID);
// use the next available value
/* CONVERT(value, DECIMAL) is used to convert varchar
Expand Down

0 comments on commit 497e4c6

Please sign in to comment.