From 11208ee064c140610ccf94ae0c6e05be00e60c85 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 13 Sep 2023 12:56:27 -0700 Subject: [PATCH 1/2] Guard against attempting to send notification to model that isn't notifiable --- app/Listeners/CheckoutableListener.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 09cb3ae8f2..2f1d45feac 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -142,9 +142,11 @@ class CheckoutableListener $notifiables = collect(); /** - * Notify the user who checked out the item + * Notify who checked out the item as long as the model can route notifications */ - $notifiables->push($event->checkedOutTo); + if (method_exists($event->checkedOutTo, 'routeNotificationFor')) { + $notifiables->push($event->checkedOutTo); + } /** * Notify Admin users if the settings is activated From 74c7f106cef77c5dd5a0d23adc4f3c965a5f547d Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 13 Sep 2023 13:43:35 -0700 Subject: [PATCH 2/2] Reset assigned_x values when changing check out to type --- resources/assets/js/snipeit.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/assets/js/snipeit.js b/resources/assets/js/snipeit.js index 70e4f80a8f..a834e22ba0 100755 --- a/resources/assets/js/snipeit.js +++ b/resources/assets/js/snipeit.js @@ -454,12 +454,18 @@ $(document).ready(function () { $('#assigned_location').hide(); $('.notification-callout').fadeOut(); + $('[name="assigned_location"]').val('').trigger('change.select2'); + $('[name="assigned_user"]').val('').trigger('change.select2'); + } else if (assignto_type == 'location') { $('#current_assets_box').fadeOut(); $('#assigned_asset').hide(); $('#assigned_user').hide(); $('#assigned_location').show(); $('.notification-callout').fadeOut(); + + $('[name="assigned_asset"]').val('').trigger('change.select2'); + $('[name="assigned_user"]').val('').trigger('change.select2'); } else { $('#assigned_asset').hide(); @@ -470,6 +476,8 @@ $(document).ready(function () { } $('.notification-callout').fadeIn(); + $('[name="assigned_asset"]').val('').trigger('change.select2'); + $('[name="assigned_location"]').val('').trigger('change.select2'); } }); });