A free open source IT asset/license management system
added a location check, to prevent notif blowing up
Godfrey Mf270672a3d92
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.phpindex ea1a4f036e..162b07d276 100644--- a/app/Listeners/CheckoutableListener.php+++ b/app/Listeners/CheckoutableListener.php@@ -225,9 +225,10 @@ class CheckoutableListenerbreak;case LicenseSeat::class:$notificationClass = CheckoutLicenseSeatNotification::class;- break;+ break;}+return new $notificationClass($event->checkoutable, $event->checkedOutTo, $event->checkedOutBy, $acceptance, $event->note);}diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.phpindex 83a01df410..3a36af7019 100644--- a/app/Notifications/CheckinAccessoryNotification.php+++ b/app/Notifications/CheckinAccessoryNotification.php@@ -126,7 +126,7 @@ class CheckinAccessoryNotification extends Notification->title("Accessory Checked In")->addStartGroupToSection('activityText')->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')- ->fact('Checked into ', $item->location->name)+ ->fact('Checked into ', $item->location->name ? $item->location->name : '')->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName())->fact('Number Remaining', $item->numRemaining())->fact('Notes', $note ?: 'No notes');diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.phpindex e8dffd7ae8..35fa3fdf9d 100644--- a/app/Notifications/CheckinAssetNotification.php+++ b/app/Notifications/CheckinAssetNotification.php@@ -99,11 +99,10 @@ class CheckinAssetNotification extends Notificationreturn MicrosoftTeamsMessage::create()->to($this->settings->webhook_endpoint)->type('success')- ->addStartGroupToSection('activityTitle')->title("Asset Checked in")->addStartGroupToSection('activityText')- ->fact(htmlspecialchars_decode($item->present()->name), '', 'header')- ->fact('Checked into ', $item->location->name)+ ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')+ ->fact('Checked into ', $item->location->name ? $item->location->name : '')->fact(trans('mail.Asset_Checkin_Notification')." by ", $admin->present()->fullName())->fact('Asset Status', $item->assetstatus->name)->fact('Notes', $note ?: 'No notes');diff --git a/app/Notifications/CheckoutAccessoryNotification.php b/app/Notifications/CheckoutAccessoryNotification.phpindex 33bed0db60..a44c193b57 100644--- a/app/Notifications/CheckoutAccessoryNotification.php+++ b/app/Notifications/CheckoutAccessoryNotification.php@@ -116,7 +116,7 @@ class CheckoutAccessoryNotification extends Notification->title("Accessory Checked Out")->addStartGroupToSection('activityText')->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')- ->fact('Checked out from ', $item->location->name)+ ->fact('Checked out from ', $item->location->name ? $item->location->name : '')->fact(trans('mail.Accessory_Checkout_Notification')." by ", $admin->present()->fullName())->fact('Number Remaining', $item->numRemaining())->fact('Notes', $note ?: 'No notes');diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.phpindex b6d31a8b61..29f1cc254b 100644--- a/app/Notifications/CheckoutAssetNotification.php+++ b/app/Notifications/CheckoutAssetNotification.php@@ -6,6 +6,7 @@ use App\Helpers\Helper;use App\Models\Asset;use App\Models\Setting;use App\Models\User;+use Exception;use Illuminate\Bus\Queueable;use Illuminate\Notifications\Messages\MailMessage;use Illuminate\Notifications\Messages\SlackMessage;@@ -129,17 +130,23 @@ class CheckoutAssetNotification extends Notification$item = $this->item;$note = $this->note;- return MicrosoftTeamsMessage::create()- ->to($this->settings->webhook_endpoint)- ->type('success')- ->addStartGroupToSection('activityTitle')- ->title("Asset Checked Out")- ->addStartGroupToSection('activityText')- ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')- ->fact('Checked out from ', $item->location->name)- ->fact(trans('mail.Asset_Checkout_Notification')." by ", $admin->present()->fullName())- ->fact('Asset Status', $item->assetstatus->name)- ->fact('Notes', $note ?: 'No notes');+ try {++ return MicrosoftTeamsMessage::create()+ ->to($this->settings->webhook_endpoint)+ ->type('success')+ ->title("Asset Checked Out")+ ->addStartGroupToSection('activityText')+ ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')+ ->fact('Checked out from ', $item->location ? $item->location->name : '')+ ->fact(trans('mail.Asset_Checkout_Notification') . " by ", $admin->present()->fullName())+ ->fact('Asset Status', $item->assetstatus->name)+ ->fact('Notes', $note ?: 'No notes');+ }+ catch(Exception $e) {+ dd($e);++ }}/**