0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-03-16 06:13:34 +00:00

Fix - Meeting invite notification emails not sending to all invitees.

This commit is contained in:
Owen Smith 2021-11-12 12:33:02 +00:00 committed by Matt Lorimer
parent 77bf446337
commit 9cbd35d351
2 changed files with 10 additions and 3 deletions
data
tests/unit/phpunit/modules/Meetings

View file

@ -419,6 +419,12 @@ class SugarBean
*/
public $createdAuditRecords;
/**
* Keeps track of emails sent to notify_user ids to avoid duplicate emails
* @var array $sentAssignmentNotifications
*/
public $sentAssignmentNotifications = array();
/**
* SugarBean constructor.
* Performs following tasks:
@ -3187,7 +3193,7 @@ class SugarBean
{
global $current_user;
if ((($this->object_name == 'Meeting' || $this->object_name == 'Call') || $notify_user->receive_notifications) && !$this->sentAssignmentNotifications) {
if ((($this->object_name == 'Meeting' || $this->object_name == 'Call') || $notify_user->receive_notifications) && !in_array($notify_user->id, $this->sentAssignmentNotifications, true)) {
$sendToEmail = $notify_user->emailAddress->getPrimaryAddress($notify_user);
$sendEmail = true;
if (empty($sendToEmail)) {
@ -3252,7 +3258,7 @@ class SugarBean
$GLOBALS['log']->fatal("Notifications: error sending e-mail (method: {$notify_mail->Mailer}), " .
"(error: {$notify_mail->ErrorInfo})");
} else {
$this->sentAssignmentNotifications = true;
$this->sentAssignmentNotifications[] = $notify_user->id;
$GLOBALS['log']->info("Notifications: e-mail successfully sent");
}
}

View file

@ -241,7 +241,8 @@ class MeetingTest extends SuitePHPUnitFrameworkTestCase
$meeting->date_start = '2016-02-11 17:30:00';
$meeting->date_end = '2016-02-11 17:30:00';
$meeting->sentAssignmentNotifications = false;
$meeting->sentAssignmentNotifications = [];
$meeting->sentAssignmentNotifications[] = $notify_user->id;
$admin = BeanFactory::newBean('Administration');
$admin->retrieveSettings();