From d9f5151c39cbb6b016a5582642bc40d00e90190f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Jun 2013 15:53:17 +0200 Subject: [PATCH] Fix: Bad default value for finished property --- htdocs/product/class/product.class.php | 6 ++---- htdocs/product/fiche.php | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6888c144a7c..2bdf4d3368b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -225,7 +225,6 @@ class Product extends CommonObject if (empty($this->status)) $this->status = 0; if (empty($this->status_buy)) $this->status_buy = 0; - if (empty($this->finished)) $this->finished = 0; $price_ht=0; $price_ttc=0; @@ -315,7 +314,7 @@ class Product extends CommonObject $sql.= ", ".$this->status; $sql.= ", ".$this->status_buy; $sql.= ", '".$this->canvas."'"; - $sql.= ", ".$this->finished; + $sql.= ", ".((! isset($this->finished) || $this->finished < 0)?'null':$this->finished); $sql.= ")"; dol_syslog(get_class($this)."::Create sql=".$sql); @@ -446,7 +445,6 @@ class Product extends CommonObject if (empty($this->localtax1_tx)) $this->localtax1_tx = 0; if (empty($this->localtax2_tx)) $this->localtax2_tx = 0; - if (empty($this->finished)) $this->finished = 0; if (empty($this->country_id)) $this->country_id = 0; $this->accountancy_code_buy = trim($this->accountancy_code_buy); @@ -464,7 +462,7 @@ class Product extends CommonObject $sql.= ",tosell = " . $this->status; $sql.= ",tobuy = " . $this->status_buy; - $sql.= ",finished = " . ($this->finished<0 ? "null" : $this->finished); + $sql.= ",finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : $this->finished); $sql.= ",weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null'); $sql.= ",weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null'); $sql.= ",length = " . ($this->length!='' ? "'".$this->length."'" : 'null'); diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 8971b93a3df..315ea66b184 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -312,7 +312,6 @@ if (empty($reshook)) $object->ref = GETPOST('clone_ref'); $object->status = 0; $object->status_buy = 0; - $object->finished = 1; $object->id = null; if ($object->check())