fix #21941 call_trigger

better fix #21941 : trigger nearest the code that justify its execution
This commit is contained in:
Eric Seigne 2022-08-29 15:57:13 +02:00
parent ec5af6cd23
commit db966495b1
2 changed files with 19 additions and 0 deletions

View File

@ -212,6 +212,15 @@ if ($action == "importSignature") {
$db->commit();
$response = "success";
setEventMessages("PropalSigned", null, 'warnings');
if (method_exists($object, 'call_trigger')) {
//customer is not a user !?! so could we use same user as validation ?
$user = new User($db);
$user->fetch($object->user_valid_id);
$result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user);
if ($result < 0) {
$error++;
}
}
} else {
$db->rollback();
$error++;

View File

@ -168,6 +168,15 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') {
$message = 'refused';
setEventMessages("PropalRefused", null, 'warnings');
if (method_exists($object, 'call_trigger')) {
//customer is not a user !?! so could we use same user as validation ?
$user = new User($db);
$user->fetch($object->user_valid_id);
$result = $object->call_trigger('PROPAL_CLOSE_REFUSED', $user);
if ($result < 0) {
$error++;
}
}
} else {
$db->rollback();
}
@ -459,6 +468,7 @@ if ($action == "dosign" && empty($cancel)) {
print '<br>';
if ($message == 'refused') {
print '<span class="ok">'.$langs->trans("PropalRefused").'</span>';
} else {
print '<span class="warning">'.$langs->trans("PropalAlreadyRefused").'</span>';
}