2
0
forked from Wavyzz/dolibarr

Compare commits

...

2 Commits
11.0.0 ... 5.0

Author SHA1 Message Date
Laurent Destailleur
474260e526 Merge pull request #13447 from c3do/patch-1
Fix can set desiredstock to (int) 0 from API Rest
2020-03-30 19:46:02 +02:00
Cédric
eead9a93d3 Fix can set desiredstock to (int) 0 from API Rest
When you set desiredstock to 0 as an integer from the API, it registers to null in the database. Using is_numeric() fixes this.
2020-03-30 13:03:13 +02:00

View File

@@ -763,7 +763,7 @@ class Product extends CommonObject
$sql.= ", duration = '" . $this->db->escape($this->duration_value . $this->duration_unit) ."'";
$sql.= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy)."'";
$sql.= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell)."'";
$sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null");
$sql.= ", desiredstock = " . ((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? $this->desiredstock : "null");
$sql.= ", cost_price = " . ($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null');
$sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
$sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1);