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);