A free open source IT asset/license management system
Only send mail to target if they have an email address
Marcus Moore2aee14a800ad
diff --git a/app/Listeners/CheckoutablesCheckedOutInBulkListener.php b/app/Listeners/CheckoutablesCheckedOutInBulkListener.phpindex 5391175bef..fa32f883bd 100644--- a/app/Listeners/CheckoutablesCheckedOutInBulkListener.php+++ b/app/Listeners/CheckoutablesCheckedOutInBulkListener.php@@ -19,17 +19,17 @@ class CheckoutablesCheckedOutInBulkListenerpublic function handle(CheckoutablesCheckedOutInBulk $event): void{- // @todo: only send if user has email address- Mail::to($event->target)->send(new BulkAssetCheckoutMail(- $event->assets,- $event->target,- $event->admin,- $event->checkout_at,- $event->expected_checkin,- $event->note,- ));+ if ($event->target->email) {+ Mail::to($event->target)->send(new BulkAssetCheckoutMail(+ $event->assets,+ $event->target,+ $event->admin,+ $event->checkout_at,+ $event->expected_checkin,+ $event->note,+ ));+ }// @todo: create and attach acceptance? Might be handled in CheckoutableListener::getCheckoutAcceptance() already.-}}diff --git a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.phpindex a8683f021c..4034a4f4fa 100644--- a/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php+++ b/tests/Feature/Notifications/Email/BulkCheckoutEmailTest.php@@ -58,8 +58,6 @@ class BulkCheckoutEmailTest extends TestCasepublic function test_email_is_not_sent_when_user_does_not_have_email_address(){- $this->markTestIncomplete();-$this->settings->disableAdminCC();$this->target = User::factory()->create(['email' => null]);