From 77b83effdf76cedc6adf551af675b9fae22bb2c9 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sat, 30 Aug 2003 11:55:12 +0000 Subject: [PATCH] =?UTF-8?q?Gestion=20des=20produits=20g=E9n=E9riques=20pou?= =?UTF-8?q?r=20la=20g=E9n=E9ration=20des=20propales=20pdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/propal.class.php3 | 42 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/htdocs/propal.class.php3 b/htdocs/propal.class.php3 index a928a0a014a..d8bbe46d66a 100644 --- a/htdocs/propal.class.php3 +++ b/htdocs/propal.class.php3 @@ -72,8 +72,8 @@ class Propal $prod = new Product($this->db, $idproduct); $prod->fetch($idproduct); - $sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, qty, price, tva_tx) VALUES "; - $sql .= " (".$this->id.",". $idproduct.",". $qty.",". $prod->price.",".$prod->tva_tx.") ; "; + $sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, qty, price, tva_tx, description) VALUES "; + $sql .= " (".$this->id.",". $idproduct.",". $qty.",". $prod->price.",".$prod->tva_tx.",'".$prod->label."') ; "; if ($this->db->query($sql) ) { @@ -343,6 +343,44 @@ class Propal { print $this->db->error(); } + + /* + * Lignes + */ + + $sql = "SELECT d.qty, d.description, d.price, d.tva_tx, d.rowid"; + $sql .= " FROM llx_propaldet as d"; + $sql .= " WHERE d.fk_propal = ".$this->id ." AND d.fk_product = 0"; + + $result = $this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows(); + $j = 0; + + while ($j < $num) + { + $objp = $this->db->fetch_object($i); + $ligne = new PropaleLigne(); + $ligne->desc = stripslashes($objp->description); + $ligne->qty = $objp->qty; + $ligne->ref = $objp->ref; + $ligne->tva_tx = $objp->tva_tx; + $ligne->price = $objp->price; + $ligne->product_id = $objp->rowid; + $this->lignes[$i] = $ligne; + $i++; + $j++; + } + + $this->db->free(); + } + else + { + print $this->db->error(); + } + + } return 1; }