From 028d875bbb6e17034ade4a041c59704e27bd2a74 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 29 Sep 2007 20:31:41 +0000 Subject: [PATCH] bugfix --- htdocs/product.class.php | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 66e8f6d39cb..da589043c77 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -881,21 +881,25 @@ class Product { $this->barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } - $sql = "SELECT code, libelle, coder"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; - $sql.= " WHERE rowid = ".$this->barcode_type; - $result = $this->db->query($sql); - if ($result) + + if ($this->barcode_type > 0) { - $result = $this->db->fetch_array(); - $this->barcode_type_code = $result["code"]; - $this->barcode_type_label = $result["libelle"]; - $this->barcode_type_coder = $result["coder"]; - } - else - { - dolibarr_print_error($this->db); - return -1; + $sql = "SELECT code, libelle, coder"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; + $sql.= " WHERE rowid = ".$this->barcode_type; + $result = $this->db->query($sql); + if ($result) + { + $result = $this->db->fetch_array(); + $this->barcode_type_code = $result["code"]; + $this->barcode_type_label = $result["libelle"]; + $this->barcode_type_coder = $result["coder"]; + } + else + { + dolibarr_print_error($this->db); + return -1; + } } }