diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 14ddea2258..5a4042aee4 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 diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 5968632fdc..eb6b738094 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; @@ -43,30 +44,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($notifiable, $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, $acceptance)); + } 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 +77,7 @@ class CheckoutableListener } } + /** * Notify the user and post to webhook about the checked in checkoutable */ @@ -101,25 +104,28 @@ class CheckoutableListener } } + $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($notifiable, $this->getCheckoutNotification($event, $acceptance)); + } + else { + Notification::send($notifiable, $this->getCheckinNotification($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') { - - 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)); } } diff --git a/app/Presenters/DepreciationReportPresenter.php b/app/Presenters/DepreciationReportPresenter.php index 6905385615..1d4c459614 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', diff --git a/resources/views/hardware/bulk-checkout.blade.php b/resources/views/hardware/bulk-checkout.blade.php index f309cadbd9..84dcdc2bb1 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;'])