Skip to content

A free open source IT asset/license management system

Added notification about… well… notifications

snipede9ebab58570
diff --git a/app/Models/AssetModel.php b/app/Models/AssetModel.php
index d25ae4686f..4a927f61f6 100755
--- a/app/Models/AssetModel.php
+++ b/app/Models/AssetModel.php
@@ -238,6 +238,11 @@ class AssetModel extends SnipeModel
return $this->belongsTo(Category::class, 'category_id');
}
+ public function requireAcceptance(): bool
+ {
+ return (bool) ($this->category?->require_acceptance ?? false);
+ }
+
/**
* Establishes the model -> depreciation relationship
*
diff --git a/resources/lang/en-US/admin/hardware/message.php b/resources/lang/en-US/admin/hardware/message.php
index 9560b5b284..4c1b8e25ec 100644
--- a/resources/lang/en-US/admin/hardware/message.php
+++ b/resources/lang/en-US/admin/hardware/message.php
@@ -191,6 +191,7 @@ return [
'no_target_assets_for_user' => ':user has no assets to install into.',
'no_available_units' => 'No available units of this model to hand out.',
'bulk_summary' => 'Fulfilled :fulfilled of :total requests.',
+ 'bulk_fulfill_notification_intro' => 'The following will apply to each ticked request when fulfilled:',
],
];
diff --git a/resources/views/blade/checkout/notification-callout.blade.php b/resources/views/blade/checkout/notification-callout.blade.php
new file mode 100644
index 0000000000..12b9ac49b2
--- /dev/null
+++ b/resources/views/blade/checkout/notification-callout.blade.php
@@ -0,0 +1,44 @@
+@props([
+ 'item',
+])
+
+{{-- Batch equivalent of the notification callout that every
+ singleton checkout screen renders. Same four conditions:
+ - the item requires acceptance (acceptance email fires)
+ - global signature-required is on (each recipient signs)
+ - the item has a EULA attached (EULA email fires)
+ - a webhook endpoint is configured (each fulfilled
+ checkout POSTs to it)
+ Sign-in-place is intentionally not offered here - bulk
+ fulfill hands out to N different requesters and there is no
+ single-user surface to sign against. --}}
+
+@if ($item->requireAcceptance() || (string) $snipeSettings->require_accept_signature === '1' || $item->getEula() || $snipeSettings->webhook_endpoint != '')
+ <div class="form-group">
+ <div class="col-md-12">
+ <x-callout type="info" role="status">
+ <strong>{{ trans('admin/hardware/message.requests.bulk_fulfill_notification_intro') }}</strong>
+ <br>
+ @if ($item->requireAcceptance())
+ <x-icon type="email" class="fa-fw"/>
+ {{ trans('admin/categories/general.required_acceptance') }}
+ <br>
+ @endif
+ @if ((string) $snipeSettings->require_accept_signature === '1')
+ <x-icon type="signature" class="fa-fw"/>
+ {{ trans('admin/categories/general.required_signature') }}
+ <br>
+ @endif
+ @if ($item->getEula())
+ <x-icon type="email" class="fa-fw"/>
+ {{ trans('admin/categories/general.required_eula') }}
+ <br>
+ @endif
+ @if ($snipeSettings->webhook_endpoint != '')
+ <i class="fab fa-slack fa-fw" aria-hidden="true"></i>
+ {{ trans('general.webhook_msg_note') }}
+ @endif
+ </x-callout>
+ </div>
+ </div>
+@endif
diff --git a/resources/views/checkouts/fulfill-multiple-to-asset.blade.php b/resources/views/checkouts/fulfill-multiple-to-asset.blade.php
index 06397d9b30..fdd2c518a7 100644
--- a/resources/views/checkouts/fulfill-multiple-to-asset.blade.php
+++ b/resources/views/checkouts/fulfill-multiple-to-asset.blade.php
@@ -38,6 +38,8 @@
</div>
</div>
+ <x-checkout.notification-callout :item="$item" />
+
{{-- $rowContext[$requestId] = ['availableAssets' => Collection, 'emptyMessage' => ?string]
Rows whose availableAssets is empty render the
row disabled (checkbox unavailable) with the
diff --git a/resources/views/checkouts/fulfill-multiple.blade.php b/resources/views/checkouts/fulfill-multiple.blade.php
index 599e9433ea..d1c97d7fe7 100644
--- a/resources/views/checkouts/fulfill-multiple.blade.php
+++ b/resources/views/checkouts/fulfill-multiple.blade.php
@@ -31,6 +31,8 @@
</div>
</div>
+ <x-checkout.notification-callout :item="$item" />
+
{{-- One row per pending CheckoutRequest, ordered
oldest-first (waiting-list). Admin ticks the
ones to fulfill; rows left unchecked stay