fix: [validation] Float validation

pull/6418/head
Jakub Onderka 2020-10-10 16:27:16 +02:00
parent 2a9feb7cd3
commit a8dcd9aec4
1 changed files with 1 additions and 9 deletions

View File

@ -919,10 +919,6 @@ class Attribute extends AppModel
$this->data['Attribute']['sharing_group_id'] = 0;
}
// return true, otherwise the object cannot be saved
if ($this->data['Attribute']['type'] == 'float' && $this->data['Attribute']['value'] == 0) {
$this->data['Attribute']['value'] = '0.0';
}
return true;
}
@ -1481,11 +1477,7 @@ class Attribute extends AppModel
$returnValue = (json_last_error() == JSON_ERROR_NONE);
break;
case 'float':
$value = floatval($value);
if (is_float($value)) {
$returnValue = true;
}
break;
return is_numeric($value);
case 'boolean':
if ($value == 1 || $value == 0) {
$returnValue = true;