From 08963d7cd69f7ae5ceba7ad6ec1c60c0f60b5315 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 28 Nov 2021 15:05:59 +1100 Subject: [PATCH] Fixes for types in user notifies --- app/Utils/Traits/Notifications/UserNotifies.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Utils/Traits/Notifications/UserNotifies.php b/app/Utils/Traits/Notifications/UserNotifies.php index c60b17441807..5b8d312c843b 100644 --- a/app/Utils/Traits/Notifications/UserNotifies.php +++ b/app/Utils/Traits/Notifications/UserNotifies.php @@ -12,6 +12,7 @@ namespace App\Utils\Traits\Notifications; use App\Models\Client; +use App\Models\Credit; use App\Models\Invoice; use App\Models\Payment; use App\Models\Quote; @@ -27,13 +28,14 @@ trait UserNotifies { public function findUserNotificationTypes($invitation, $company_user, $entity_name, $required_permissions) :array { - if ($company_user->company->is_disabled) { - return []; - } $notifiable_methods = []; $notifications = $company_user->notifications; + if ($company_user->company->is_disabled && is_array($notifications->email)) { + return []; + } + //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) { $required_permissions = $this->addSpecialUserPermissionForEntity($invitation->{$entity_name}, $required_permissions);