FIX Trigger must be inside the transaction
This commit is contained in:
parent
9c0b2e6abe
commit
a5e5362cb0
@ -9729,23 +9729,24 @@ abstract class CommonObject
|
|||||||
$tmpforobjectclass = get_class($this);
|
$tmpforobjectclass = get_class($this);
|
||||||
$tmpforobjectlineclass = ucfirst($tmpforobjectclass).'Line';
|
$tmpforobjectlineclass = ucfirst($tmpforobjectclass).'Line';
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('LINE'.strtoupper($tmpforobjectclass).'_DELETE', $user);
|
$result = $this->call_trigger('LINE'.strtoupper($tmpforobjectclass).'_DELETE', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
return -1;
|
$error++;
|
||||||
}
|
}
|
||||||
// End call triggers
|
// 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;
|
$resql = $this->db->query($sql);
|
||||||
$sql .= " WHERE rowid = ".((int) $idline);
|
if (!$resql) {
|
||||||
|
$this->error = "Error ".$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::deleteLineCommon", LOG_DEBUG);
|
$error++;
|
||||||
$resql = $this->db->query($sql);
|
}
|
||||||
if (!$resql) {
|
|
||||||
$this->error = "Error ".$this->db->lasterror();
|
|
||||||
$error++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($error)) {
|
if (empty($error)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user