N°2039 - Prevent Persons with no User linked from being notified

This commit is contained in:
Stephen Abello
2024-02-14 15:18:52 +01:00
parent 2bd40bef47
commit d775658980

View File

@@ -166,6 +166,10 @@
$oRecipientsSet = new DBObjectSet($oRecipientsSearch);
[$sPreviousLanguage, $aPreviousPluginProperties] = $this->SetNotificationLanguage();
while ($oRecipient = $oRecipientsSet->Fetch()) {
// Skip recipients that have no users
if(get_class($oRecipient) === Person::class && UserRights::GetUserFromPerson($oRecipient) === null) {
continue;
}
$oEvent = new EventiTopNotification();
$oEvent->Set('title', MetaModel::ApplyParams($this->Get('title'), $aContextArgs));
$oEvent->Set('message', MetaModel::ApplyParams($this->Get('message'), $aContextArgs));