From 75e80411ba7a7ff5438296c92213ff023aec6985 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 7 Mar 2006 09:58:54 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20erreur=20sql=20si=20pas=20d'entrep=F4t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/product.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 9c7953f7370..52573995181 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -1328,15 +1328,14 @@ class Product */ function correct_stock($user, $id_entrepot, $nbpiece, $mouvement) { - + if ($id_entrepot) + { $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."product_stock "; $sql .= " WHERE fk_product = $this->id AND fk_entrepot = $id_entrepot"; if ($this->db->query($sql) ) { $row = $this->db->fetch_row(0); - if ($id_entrepot) - { if ($row[0] > 0) { return $this->ajust_stock($user, $id_entrepot, $nbpiece, $mouvement); @@ -1345,14 +1344,14 @@ class Product { return $this->create_stock($id_entrepot, $nbpiece); } - } } else { dolibarr_print_error($this->db); $this->db->rollback(); return -1; - } + } + } }