Fix price2num needs lang loaded when it may not exists

This commit is contained in:
Laurent Destailleur 2019-11-09 12:46:45 +01:00
parent 917c8df225
commit c0abb725cb

View File

@ -7260,9 +7260,11 @@ abstract class CommonObject
return false; return false;
} }
/** /**
* Function to prepare the values to insert. * Function to prepare a part of the query for insert.
* Note $this->${field} are set by the page that make the createCommon or the updateCommon. * Note $this->${field} are set by the page that make the createCommon or the updateCommon.
* $this->${field} should be a clean value. The page can run
* *
* @return array * @return array
*/ */
@ -7301,13 +7303,13 @@ abstract class CommonObject
if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field]=$conf->entity; if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field]=$conf->entity;
else else
{ {
$queryarray[$field] = (int) price2num($this->{$field}); $queryarray[$field] = (int) $this->{$field};
if (empty($queryarray[$field])) $queryarray[$field]=0; // May be reset to null later if property 'notnull' is -1 for this field. if (empty($queryarray[$field])) $queryarray[$field]=0; // May be reset to null later if property 'notnull' is -1 for this field.
} }
} }
elseif($this->isFloat($info)) elseif($this->isFloat($info))
{ {
$queryarray[$field] = (double) price2num($this->{$field}); $queryarray[$field] = (double) $this->{$field};
if (empty($queryarray[$field])) $queryarray[$field]=0; if (empty($queryarray[$field])) $queryarray[$field]=0;
} }
else else