FIX: contact deletion: execute trigger before really deleting

This commit is contained in:
Marc de Lima Lucio 2022-10-03 15:16:41 +02:00
parent 02cad2c23e
commit 787de2fd8a

View File

@ -1208,6 +1208,15 @@ class Contact extends CommonObject
$this->db->begin();
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_DELETE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
// Get all rowid of element_contact linked to a type that is link to llx_socpeople
$sql = "SELECT ec.rowid";
@ -1298,15 +1307,6 @@ class Contact extends CommonObject
}
}
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_DELETE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return 1;