diff --git a/htdocs/facture.class.php3 b/htdocs/facture.class.php3 index 4f5c09632c6..d512a37ccaf 100644 --- a/htdocs/facture.class.php3 +++ b/htdocs/facture.class.php3 @@ -41,7 +41,7 @@ class Facture { * */ - Function Facture($DB, $soc_idp="") { + Function Facture($DB, $soc_idp="", $facid="") { $this->db = $DB ; $this->socidp = $soc_idp; $this->products = array(); @@ -51,6 +51,7 @@ class Facture { $this->tva = 0; $this->total = 0; $this->propalid = 0; + $this->id = $facid; } /* * @@ -230,8 +231,6 @@ class Facture { */ Function addline($facid, $desc, $pu, $qty) { - global $conf; - $sql = "INSERT INTO llx_facturedet (fk_facture,description,price,qty) VALUES ($facid, '$desc', $pu, $qty) ;"; $result = $this->db->query( $sql); @@ -241,6 +240,17 @@ class Facture { * * */ + Function updateline($rowid, $desc, $pu, $qty) + { + $sql = "UPDATE llx_facturedet set description='$desc',price=$pu,qty=$qty WHERE rowid = $rowid ;"; + $result = $this->db->query( $sql); + + $this->updateprice($this->id); + } + /* + * + * + */ Function deleteline($rowid) { $sql = "DELETE FROM llx_facturedet WHERE rowid = $rowid;";