In version 8.2.2 notifications are sent to the wrong person.
In Notification.php in the save function if it is a new notification, then it overwrites the idUser that is set in NotificationDefinition.php.
I changed this part as follows, if idUser and IdResource is set, then it won't overwrite:
if (is_null($this->id)) {
// Inits the status to unread
$this->idStatusNotification = 1;
// Inits creationDate with today
$this->creationDateTime=date('Y-m-d H:i:s');
// idUser is in fact the receiver
if (is_null($this->idUser)){$this->idUser = $this->idResource;}
// idResource = connected user ==> $userId
if (is_null($this->idResource)){$this->idResource = $userId;}
}
Hi,
Thanks for posting the issue and proposing patch.*
There was a little specific case that your fix did not take into account.
Whan direcly creating a notification (not from definition), notification was send to sended instead of receiver.
This was the reason of this strange change of idUser.
Fix is ready for V8.2.3 and works on both cases.
Hi,
Thanks, it is ok now.
Regards,
Zsolt