Merge pull request #22477 from marc-dll/14.0_FIX_contact_delete_trigger

FIX: contact deletion: execute trigger before really deleting
This commit is contained in:
Laurent Destailleur 2022-10-04 16:57:52 +02:00 committed by GitHub
commit a8d194ae0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;