From 2222ceb739ea0a1c2e0da032b0b9736de6d64187 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 13 Apr 2005 14:30:41 +0000 Subject: [PATCH] Ajout verification des valeurs dans create --- htdocs/product.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product.class.php b/htdocs/product.class.php index a68b7bc1ad8..e7baa86f798 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -109,14 +109,14 @@ class Product $row = $this->db->fetch_array(); if ($row[0] == 0) { + if (strlen($this->tva_tx)==0) $this->tva_tx = 0; + if (strlen($this->price)==0) $this->price = 0; + if (strlen($this->envente)==0) $this->envente = 0; + + $this->price = ereg_replace(",",".",$this->price); - if (strlen($this->price)==0) - { - $this->price = 0; - } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."product (datec, fk_user_author, fk_product_type, price)"; - $sql .= " VALUES (now(),".$user->id.",$this->type, '" . ereg_replace(",",".",$this->price) . "')"; + $sql .= " VALUES (now(),".$user->id.",$this->type, '" . $this->price . "')"; $result = $this->db->query($sql); if ( $result ) {