mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-09 01:12:33 +01:00
FIX Trigger must be inside the transaction
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user