Commit 471bb61f authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #17192 TIME 0:45 Send notification to original user even if there is substitute user

parent 63930231
......@@ -267,19 +267,25 @@ class EmailController
public static function sendNotificationToNextUserInWorkflow(array $args)
{
$nextUser = UserModel::getById(['select' => ['email', 'preferences', 'substitute'], 'id' => $args['recipientId']]);
EmailController::sendNotificationToUser(['documentId' => $args['documentId'], 'senderId' => $args['senderId'], 'email' => $nextUser['email'], 'preferences' => $nextUser['preferences']]);
if (!empty($nextUser['substitute'])) {
$nextUser = UserModel::getById(['select' => ['email', 'preferences'], 'id' => $nextUser['substitute']]);
$nextSubstituteUser = UserModel::getById(['select' => ['email', 'preferences'], 'id' => $nextUser['substitute']]);
EmailController::sendNotificationToUser(['documentId' => $args['documentId'], 'senderId' => $args['senderId'], 'email' => $nextSubstituteUser['email'], 'preferences' => $nextSubstituteUser['preferences']]);
}
}
$nextUser['preferences'] = json_decode($nextUser['preferences'], true);
if ($nextUser['preferences']['notifications']) {
$lang = LanguageController::get(['lang' => $nextUser['preferences']['lang']]);
public static function sendNotificationToUser(array $args)
{
$args['preferences'] = json_decode($args['preferences'], true);
if ($args['preferences']['notifications']) {
$lang = LanguageController::get(['lang' => $args['preferences']['lang']]);
$url = UrlController::getCoreUrl() . 'dist/documents/' . $args['documentId'];
EmailController::createEmail([
'userId' => $args['senderId'],
'data' => [
'sender' => 'Notification',
'recipients' => [$nextUser['email']],
'recipients' => [$args['email']],
'subject' => $lang['notificationDocumentAddedSubject'],
'body' => $lang['notificationDocumentAddedBody'] . '<a href="' . $url . '">'.$url.'</a>' . $lang['notificationFooter'],
'isHtml' => true
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment