From de41def2b323d8f9227f56b6a84380f9039beb00 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Thu, 5 Dec 2024 10:15:57 -0800 Subject: [PATCH] fixed conditionals --- app/Http/Controllers/ReportsController.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 51484fe216..fa454cbc01 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -1152,13 +1152,14 @@ class ReportsController extends Controller } $logItem = $logItem_res[0]; } - + $email = $assetItem->assignedTo?->email; + $locale = $assetItem->assignedTo?->locale; // Only send notification if assigned - if ($assetItem->assignedTo?->email) { - Mail::to($assetItem->assignedTo->email)->send((new CheckoutAssetMail($assetItem, $assetItem->assignedTo, $logItem->user, $logItem->note, $acceptance))->locale($assetItem->assignedTo?->locale)); + if ($locale && $email) { + Mail::to($email)->send((new CheckoutAssetMail($assetItem, $assetItem->assignedTo, $logItem->user, $logItem->note, $acceptance))->locale($locale)); - } else { - Mail::to($assetItem->assignedTo->email)->send((new CheckoutAssetMail($assetItem, $assetItem->assignedTo, $logItem->user, $logItem->note, $acceptance))); + } elseif ($email) { + Mail::to($email)->send((new CheckoutAssetMail($assetItem, $assetItem->assignedTo, $logItem->user, $logItem->note, $acceptance))); } if ($assetItem->assignedTo?->email == ''){