From fd1b5c9158878de64d7245944e2782a5c8558350 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 18 Nov 2003 09:31:26 +0000 Subject: [PATCH] =?UTF-8?q?Set=20un=20libell=E9=20par=20d=E9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/product.class.php | 94 +++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/htdocs/product.class.php b/htdocs/product.class.php index b7129d85ecc..f045fe24ad1 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -64,7 +64,7 @@ class Product return 1; } } - /* + /** * * */ @@ -116,7 +116,44 @@ class Product } } } - /* + /** + * + * + * + */ + Function update($id, $user) + { + + if (strlen(trim($this->libelle)) == 0) + { + $this->libelle = 'LIBELLE MANQUANT'; + } + + $sql = "UPDATE llx_product "; + $sql .= " SET label = '" . trim($this->libelle) ."'"; + if (strlen(trim($this->ref))) + { + $sql .= ",ref = '" . trim($this->ref) ."'"; + } + $sql .= ",tva_tx = " . $this->tva_tx ; + $sql .= ",envente = " . $this->envente ; + $sql .= ",seuil_stock_alerte = " . $this->seuil_stock_alerte ; + $sql .= ",description = '" . trim($this->description) ."'"; + $sql .= ",duration = '" . $this->duration_value . $this->duration_unit ."'"; + + $sql .= " WHERE rowid = " . $id; + + if ( $this->db->query($sql) ) + { + return 1; + } + else + { + print $this->db->error() . ' in ' . $sql; + } + } + /** + * * */ Function _log_price($user) @@ -171,42 +208,7 @@ class Product } } - /* - * - * - * - */ - Function update($id, $user) - { - if (strlen(trim($this->ref))) - { - $sql = "UPDATE llx_product "; - $sql .= " SET label = '" . trim($this->libelle) ."'"; - $sql .= ",ref = '" . trim($this->ref) ."'"; - $sql .= ",tva_tx = " . $this->tva_tx ; - $sql .= ",envente = " . $this->envente ; - $sql .= ",seuil_stock_alerte = " . $this->seuil_stock_alerte ; - $sql .= ",description = '" . trim($this->description) ."'"; - $sql .= ",duration = '" . $this->duration_value . $this->duration_unit ."'"; - - $sql .= " WHERE rowid = " . $id; - - if ( $this->db->query($sql) ) - { - return 1; - } - else - { - print $this->db->error() . ' in ' . $sql; - } - } - else - { - $this->mesg_error = "Vous devez indiquer une référence"; - return 0; - } - } - /* + /** * * * @@ -241,21 +243,25 @@ class Product $this->db->free(); - $sql = "SELECT sum(reel) as reel"; + $sql = "SELECT reel, fk_entrepot"; $sql .= " FROM llx_product_stock WHERE fk_product = $id"; $result = $this->db->query($sql) ; if ( $result ) { $num = $this->db->num_rows(); + $i=0; if ($num > 0) { - $result = $this->db->fetch_array(); + while ($i < $num ) + { + $row = $this->db->fetch_row($i); + $this->stock_entrepot[$row[1]] = $row[0]; + + $this->stock_reel = $this->stock_reel + $row[0]; + $i++; + } $this->no_stock = 0; - - $this->stock_reel = $result["reel"]; - $this->stock_proposition = $result["proposition"]; - $this->stock_commande = $result["commande"]; } else {