Merge pull request #15767 from ninichat/feat/hook_subscription_mail_send

New: Add sendMail hook in subscription
This commit is contained in:
Laurent Destailleur 2020-12-16 15:18:49 +01:00 committed by GitHub
commit 2d841d6b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -300,6 +300,23 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if (!$error) { if (!$error) {
// Send confirmation Email // Send confirmation Email
if ($object->email && $sendalsoemail) { // $object is 'Adherent' if ($object->email && $sendalsoemail) { // $object is 'Adherent'
$parameters = array(
'datesubscription' => $datesubscription,
'amount' => $amount,
'ccountid' => $accountid,
'operation' => $operation,
'label' => $label,
'num_chq' => $num_chq,
'emetteur_nom' => $emetteur_nom,
'emetteur_banque' => $emetteur_banque,
'datesubend' => $datesubend
);
$reshook = $hookmanager->executeHooks('sendMail', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$subject = ''; $subject = '';
$msg = ''; $msg = '';
@ -352,6 +369,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
} else { } else {
setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs'); setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs');
} }
}
} else { } else {
setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs'); setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs');
} }