FIX #13274 cannot add or update 0 value for an int or double extrafield

type
This commit is contained in:
Laurent Destailleur 2020-03-05 00:43:51 +01:00
parent 55dc3d36ac
commit a98b65ad99

View File

@ -5380,7 +5380,7 @@ abstract class CommonObject
// Add field of attribute
if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] != 'separate') // Only for other type than separator)
{
if ($new_array_options[$key] != '')
if ($new_array_options[$key] != '' || $new_array_options[$key] == '0')
{
$sql .= ",'".$this->db->escape($new_array_options[$key])."'";
}
@ -5482,7 +5482,7 @@ abstract class CommonObject
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
}
elseif ($value == '')
elseif ($value === '')
{
$this->array_options["options_".$key] = null;
}
@ -5495,7 +5495,7 @@ abstract class CommonObject
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
}
elseif ($value == '')
elseif ($value === '')
{
$this->array_options["options_".$key] = null;
}