FIX Trigger must be inside the transaction

This commit is contained in:
Laurent Destailleur
2022-12-21 21:24:54 +01:00
parent 9c0b2e6abe
commit a5e5362cb0

View File

@@ -9729,23 +9729,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)) {