From cb736f5b93da0bb25f8caffe824cd148fb0e251e Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 21 Sep 2016 12:05:18 +0200 Subject: [PATCH] Add update_total function (like on other element) the goal is to have and use the same function in all the native standard element (proposal, order, bill / customer and fournish) --- .../fourn/class/fournisseur.facture.class.php | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 4a9960d49a4..604141cb1cf 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2481,6 +2481,38 @@ class SupplierInvoiceLine extends CommonObjectLine $this->db->rollback(); return -2; } - } -} + + /** + * Mise a jour de l'objet ligne de commande en base + * + * @return int <0 si ko, >0 si ok + */ + function update_total() + { + $this->db->begin(); + // Mise a jour ligne en base + $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; + $sql.= " total_ht='".price2num($this->total_ht)."'"; + $sql.= ", tva='".price2num($this->total_tva)."'"; + $sql.= ", total_localtax1='".price2num($this->total_localtax1)."'"; + $sql.= ", total_localtax2='".price2num($this->total_localtax2)."'"; + $sql.= ", total_ttc='".price2num($this->total_ttc)."'"; + $sql.= " WHERE rowid = ".$this->rowid; + + dol_syslog("CommandeFournisseurLigne.class.php::update_total", LOG_DEBUG); + + $resql=$this->db->query($sql); + if ($resql) + { + $this->db->commit(); + return 1; + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -2; + } + } + }