FIX Trigger must be inside the transaction

This commit is contained in:
Laurent Destailleur 2022-12-21 21:24:54 +01:00
parent b0fdf83922
commit a35fe49100

View File

@ -9723,23 +9723,24 @@ abstract class CommonObject
$tmpforobjectclass = get_class($this);
$tmpforobjectlineclass = ucfirst($tmpforobjectclass).'Line';
$this->db->begin();
// Call trigger
$result = $this->call_trigger('LINE'.strtoupper($tmpforobjectclass).'_DELETE', $user);
if ($result < 0) {
return -1;
$error++;
}
// End call triggers
$this->db->begin();
if (empty($error)) {
$sql = "DELETE FROM ".$this->db->prefix().$this->table_element_line;
$sql .= " WHERE rowid = ".((int) $idline);
$sql = "DELETE FROM ".$this->db->prefix().$this->table_element_line;
$sql .= " WHERE rowid = ".((int) $idline);
dol_syslog(get_class($this)."::deleteLineCommon", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = "Error ".$this->db->lasterror();
$error++;
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = "Error ".$this->db->lasterror();
$error++;
}
}
if (empty($error)) {