mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 05:32:39 +01:00
Fixes for notifications
This commit is contained in:
parent
41de6a4062
commit
f1ced66226
@ -54,7 +54,7 @@ class CreditEmailedNotification implements ShouldQueue
|
||||
|
||||
// $notification = new EntitySentNotification($event->invitation, 'credit');
|
||||
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'credit', ['all_notifications', 'credit_sent']);
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'credit', ['all_notifications', 'credit_sent', 'credit_sent_all']);
|
||||
|
||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||
unset($methods[$key]);
|
||||
|
@ -60,7 +60,7 @@ class InvoiceEmailedNotification implements ShouldQueue
|
||||
// $notification = new EntitySentNotification($event->invitation, 'invoice');
|
||||
|
||||
/* Returns an array of notification methods */
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent']);
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent', 'invoice_sent_all']);
|
||||
|
||||
/* If one of the methods is email then we fire the EntitySentMailer */
|
||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||
|
@ -56,7 +56,7 @@ class InvoiceFailedEmailNotification
|
||||
|
||||
// $notification = new EntitySentNotification($event->invitation, 'invoice');
|
||||
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent']);
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent', 'invoice_sent_all']);
|
||||
|
||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||
unset($methods[$key]);
|
||||
|
@ -55,7 +55,7 @@ class QuoteEmailedNotification implements ShouldQueue
|
||||
|
||||
// $notification = new EntitySentNotification($event->invitation, 'quote');
|
||||
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'quote', ['all_notifications', 'quote_sent']);
|
||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'quote', ['all_notifications', 'quote_sent', 'quote_sent_all']);
|
||||
|
||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||
unset($methods[$key]);
|
||||
|
@ -30,15 +30,9 @@ trait UserNotifies
|
||||
$notifications = $company_user->notifications;
|
||||
|
||||
//if a user owns this record or is assigned to it, they are attached the permission for notification.
|
||||
// if ($invitation->{$entity_name}->user_id == $company_user->_user_id || $invitation->{$entity_name}->assigned_user_id == $company_user->user_id) {
|
||||
// array_push($required_permissions, 'all_user_notifications');
|
||||
// }
|
||||
nlog($notifications);
|
||||
nlog($required_permissions);
|
||||
nlog($notifications->email);
|
||||
nlog(count(array_intersect($required_permissions, $notifications->email)));
|
||||
nlog(count(array_intersect(['all_user_notifications'], $notifications->email)));
|
||||
nlog(count(array_intersect(['all_notifications'],$notifications->email)));
|
||||
if ($invitation->{$entity_name}->user_id == $company_user->_user_id || $invitation->{$entity_name}->assigned_user_id == $company_user->user_id) {
|
||||
array_push($required_permissions, 'all_user_notifications');
|
||||
}
|
||||
|
||||
if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect(['all_user_notifications'], $notifications->email)) >= 1 || count(array_intersect(['all_notifications'],$notifications->email)) >= 1) {
|
||||
array_push($notifiable_methods, 'mail');
|
||||
@ -65,9 +59,9 @@ nlog($notifiable_methods);
|
||||
return [];
|
||||
}
|
||||
|
||||
// if ($entity->user_id == $company_user->_user_id || $entity->assigned_user_id == $company_user->user_id) {
|
||||
// array_push($required_permissions, 'all_user_notifications');
|
||||
// }
|
||||
if ($entity->user_id == $company_user->_user_id || $entity->assigned_user_id == $company_user->user_id) {
|
||||
array_push($required_permissions, 'all_user_notifications');
|
||||
}
|
||||
|
||||
if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect($required_permissions, ['all_user_notifications'])) >= 1 || count(array_intersect($required_permissions, ['all_notifications'])) >= 1) {
|
||||
array_push($notifiable_methods, 'mail');
|
||||
|
Loading…
Reference in New Issue
Block a user