From 62a5c8b6dab52af7ddf3284fe68853f5689fe7ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Jan 2021 15:33:12 +0100 Subject: [PATCH] FIX Bad balance of begin commit --- htdocs/compta/facture/class/facture-rec.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 29e78f90af8..1a50fadcc9c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -2072,6 +2072,8 @@ class FactureLigneRec extends CommonInvoiceLine $sql .= ", fk_contract_line=".($this->fk_contract_line ? $this->fk_contract_line : "null"); $sql .= " WHERE rowid = ".$this->id; + $this->db->begin(); + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -2091,13 +2093,18 @@ class FactureLigneRec extends CommonInvoiceLine $result = $this->call_trigger('LINEBILLREC_UPDATE', $user); if ($result < 0) { - $this->db->rollback(); - return -2; + $error++; } // End call triggers } - $this->db->commit(); - return 1; + + if ($error) { + $this->db->rollback(); + return -2; + } else { + $this->db->commit(); + return 1; + } } else { $this->error = $this->db->lasterror(); $this->db->rollback();