From c40209f5000aaf9c6ec3449cec6463d956dd19bb Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 18 Sep 2024 15:23:44 -0700 Subject: [PATCH 1/6] seperates emails and webhook notifications --- app/Listeners/CheckoutableListener.php | 75 ++++++++++++++------------ 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 5968632fd..5c7e77297 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -43,30 +43,31 @@ class CheckoutableListener * Make a checkout acceptance and attach it in the notification */ $acceptance = $this->getCheckoutAcceptance($event); + $notifiables = $this->getNotifiables($event); + // Send email notifications try { - if (! $event->checkedOutTo->locale) { - Notification::locale(Setting::getSettings()->locale)->send( - $this->getNotifiables($event), - $this->getCheckoutNotification($event, $acceptance) - ); - } else { - Notification::send( - $this->getNotifiables($event), - $this->getCheckoutNotification($event, $acceptance) - ); + foreach ($notifiables as $notifiable) { + if ($notifiable instanceof User && $notifiable->email != '') { + if (! $event->checkedOutTo->locale){ + Notification::locale(Setting::getSettings()->locale)->send($notifiables, $this->getCheckoutNotification($event, $acceptance)); + } + else { + Notification::send($notifiable, $this->getCheckoutNotification($event, $acceptance)); + } + } } + // Send Webhook notification if ($this->shouldSendWebhookNotification()) { - - //slack doesn't include the url in its messaging format so this is needed to hit the endpoint - - if(Setting::getSettings()->webhook_selected =='slack' || Setting::getSettings()->webhook_selected =='general') { - - - Notification::route('slack', Setting::getSettings()->webhook_endpoint) - ->notify($this->getCheckoutNotification($event)); - } + // Slack doesn't include the URL in its messaging format, so this is needed to hit the endpoint + if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') { + Notification::route('slack', Setting::getSettings()->webhook_endpoint) + ->notify($this->getCheckoutNotification($event)); + } else { + Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) + ->notify($this->getCheckoutNotification($event, $acceptance)); + } } } catch (ClientException $e) { Log::debug("Exception caught during checkout notification: " . $e->getMessage()); @@ -75,6 +76,7 @@ class CheckoutableListener } } + /** * Notify the user and post to webhook about the checked in checkoutable */ @@ -100,26 +102,29 @@ class CheckoutableListener } } } - + $acceptance = $this->getCheckoutAcceptance($event); + $notifiables = $this->getNotifiables($event); + // Send email notifications try { - // Use default locale - if (! $event->checkedOutTo->locale) { - Notification::locale(Setting::getSettings()->locale)->send( - $this->getNotifiables($event), - $this->getCheckinNotification($event) - ); - } else { - Notification::send( - $this->getNotifiables($event), - $this->getCheckinNotification($event) - ); + foreach ($notifiables as $notifiable) { + if ($notifiable instanceof User && $notifiable->email != '') { + if (! $event->checkedOutTo->locale){ + Notification::locale(Setting::getSettings()->locale)->send($notifiables, $this->getCheckoutNotification($event, $acceptance)); + } + else { + Notification::send($notifiable, $this->getCheckinNotification($event, $acceptance)); + } + } } - //slack doesn't include the url in its messaging format so this is needed to hit the endpoint - if(Setting::getSettings()->webhook_selected =='slack' || Setting::getSettings()->webhook_selected =='general') { - - if ($this->shouldSendWebhookNotification()) { + // Send Webhook notification + if ($this->shouldSendWebhookNotification()) { + // Slack doesn't include the URL in its messaging format, so this is needed to hit the endpoint + if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') { Notification::route('slack', Setting::getSettings()->webhook_endpoint) ->notify($this->getCheckinNotification($event)); + } else { + Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) + ->notify($this->getCheckinNotification($event, $acceptance)); } } From 4ff5fc1ff9528e10218106db85902c644afedc4c Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 18 Sep 2024 16:19:35 -0700 Subject: [PATCH 2/6] clean up variables --- app/Listeners/CheckoutableListener.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 5c7e77297..6f9e867af 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -50,7 +50,7 @@ class CheckoutableListener foreach ($notifiables as $notifiable) { if ($notifiable instanceof User && $notifiable->email != '') { if (! $event->checkedOutTo->locale){ - Notification::locale(Setting::getSettings()->locale)->send($notifiables, $this->getCheckoutNotification($event, $acceptance)); + Notification::locale(Setting::getSettings()->locale)->send($notifiable, $this->getCheckoutNotification($event, $acceptance)); } else { Notification::send($notifiable, $this->getCheckoutNotification($event, $acceptance)); @@ -63,7 +63,7 @@ class CheckoutableListener // Slack doesn't include the URL in its messaging format, so this is needed to hit the endpoint if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') { Notification::route('slack', Setting::getSettings()->webhook_endpoint) - ->notify($this->getCheckoutNotification($event)); + ->notify($this->getCheckoutNotification($event, $acceptance)); } else { Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) ->notify($this->getCheckoutNotification($event, $acceptance)); @@ -102,17 +102,17 @@ class CheckoutableListener } } } - $acceptance = $this->getCheckoutAcceptance($event); + $notifiables = $this->getNotifiables($event); // Send email notifications try { foreach ($notifiables as $notifiable) { if ($notifiable instanceof User && $notifiable->email != '') { if (! $event->checkedOutTo->locale){ - Notification::locale(Setting::getSettings()->locale)->send($notifiables, $this->getCheckoutNotification($event, $acceptance)); + Notification::locale(Setting::getSettings()->locale)->send($notifiable, $this->getCheckoutNotification($event, $acceptance)); } else { - Notification::send($notifiable, $this->getCheckinNotification($event, $acceptance)); + Notification::send($notifiable, $this->getCheckinNotification($event)); } } } @@ -124,7 +124,7 @@ class CheckoutableListener ->notify($this->getCheckinNotification($event)); } else { Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) - ->notify($this->getCheckinNotification($event, $acceptance)); + ->notify($this->getCheckinNotification($event)); } } From b32ab6a06ce226562add8a8654dd9307efe6abea Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 18 Sep 2024 16:36:24 -0700 Subject: [PATCH 3/6] import User model --- app/Listeners/CheckoutableListener.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 6f9e867af..eb6b73809 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -11,6 +11,7 @@ use App\Models\Consumable; use App\Models\LicenseSeat; use App\Models\Recipients\AdminRecipient; use App\Models\Setting; +use App\Models\User; use App\Notifications\CheckinAccessoryNotification; use App\Notifications\CheckinAssetNotification; use App\Notifications\CheckinLicenseSeatNotification; From 3f311ba2fb37c19a4f728720b06a5bfee9ded63d Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Wed, 25 Sep 2024 21:27:45 +0100 Subject: [PATCH 4/6] Get us better debugging output for new Github Stale Action --- .github/workflows/stale.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 14ddea225..5a4042aee 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -14,7 +14,8 @@ jobs: - uses: actions/stale@v9 with: debug-only: true - operations-per-run: 100 # just while we're debugging + ascending: true + operations-per-run: 1000 # just while we're debugging repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-stale: 60 days-before-close: 7 From 68e3f375fc1fecd0baf0e4a5346b05717e332749 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 30 Sep 2024 11:15:49 -0700 Subject: [PATCH 5/6] removes sortablity from current value column --- app/Presenters/DepreciationReportPresenter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Presenters/DepreciationReportPresenter.php b/app/Presenters/DepreciationReportPresenter.php index 690538561..1d4c45961 100644 --- a/app/Presenters/DepreciationReportPresenter.php +++ b/app/Presenters/DepreciationReportPresenter.php @@ -140,7 +140,7 @@ class DepreciationReportPresenter extends Presenter ], [ "field" => "book_value", "searchable" => true, - "sortable" => true, + "sortable" => false, "visible" => true, "title" => trans('admin/hardware/table.book_value'), "footerFormatter" => 'sumFormatter', From 12da43303f162feed2c68bfd9b181760ff1a5d8c Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 1 Oct 2024 01:44:05 +0100 Subject: [PATCH 6/6] Fixed #15584 - regression with required css change Signed-off-by: snipe --- resources/views/hardware/bulk-checkout.blade.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/hardware/bulk-checkout.blade.php b/resources/views/hardware/bulk-checkout.blade.php index f309cadbd..84dcdc2bb 100644 --- a/resources/views/hardware/bulk-checkout.blade.php +++ b/resources/views/hardware/bulk-checkout.blade.php @@ -41,9 +41,9 @@ @include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true']) - @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_user', 'required'=>'true']) - @include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.asset'), 'fieldname' => 'assigned_asset', 'unselect' => 'true', 'style' => 'display:none;', 'required'=>'true']) - @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'style' => 'display:none;', 'required'=>'true']) + @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_user']) + @include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.asset'), 'fieldname' => 'assigned_asset', 'unselect' => 'true', 'style' => 'display:none;']) + @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'style' => 'display:none;'])