Skip to content

A free open source IT asset/license management system

add email check to listener

Godfrey M123cdeb858a8
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php
index 3e23259fb6..ff76ae020e 100644
--- a/app/Listeners/CheckoutableListener.php
+++ b/app/Listeners/CheckoutableListener.php
@@ -17,6 +17,7 @@ use App\Models\Component;
use App\Models\Consumable;
use App\Models\LicenseSeat;
use App\Models\Setting;
+use App\Models\User;
use App\Notifications\CheckinAccessoryNotification;
use App\Notifications\CheckinAssetNotification;
use App\Notifications\CheckinLicenseSeatNotification;
@@ -64,13 +65,14 @@ class CheckoutableListener
* 2. The item has a EULA
* 3. The item should send an email at check-in/check-out
*/
-
+ if ($notifiable instanceof User && $notifiable->email != '') {
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
Mail::to($notifiable)->send($mailable);
- Log::info('Sending email, Locale: ' .($event->checkedOutTo->locale ?? 'default'));
+ Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
}
+ }
// Send Webhook notification
if ($this->shouldSendWebhookNotification()) {