FIX Bad balance of begin commit

This commit is contained in:
Laurent Destailleur 2021-01-15 15:33:12 +01:00
parent c778eafc4a
commit 8e1128ef10

View File

@ -2072,6 +2072,8 @@ class FactureLigneRec extends CommonInvoiceLine
$sql .= ", fk_contract_line=".($this->fk_contract_line ? $this->fk_contract_line : "null"); $sql .= ", fk_contract_line=".($this->fk_contract_line ? $this->fk_contract_line : "null");
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
$this->db->begin();
dol_syslog(get_class($this)."::updateline", LOG_DEBUG); dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -2091,13 +2093,18 @@ class FactureLigneRec extends CommonInvoiceLine
$result = $this->call_trigger('LINEBILLREC_UPDATE', $user); $result = $this->call_trigger('LINEBILLREC_UPDATE', $user);
if ($result < 0) if ($result < 0)
{ {
$this->db->rollback(); $error++;
return -2;
} }
// End call triggers // End call triggers
} }
$this->db->commit();
return 1; if ($error) {
$this->db->rollback();
return -2;
} else {
$this->db->commit();
return 1;
}
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
$this->db->rollback(); $this->db->rollback();