Skip to content

A free open source IT asset/license management system

Revert "Avoid showing EULA"

Marcus Moore8396e27a2cd3
diff --git a/app/Mail/BulkAssetCheckoutMail.php b/app/Mail/BulkAssetCheckoutMail.php
index b1a6ff5286..e3244aa1dd 100644
--- a/app/Mail/BulkAssetCheckoutMail.php
+++ b/app/Mail/BulkAssetCheckoutMail.php
@@ -49,6 +49,7 @@ class BulkAssetCheckoutMail extends Mailable
'requires_acceptance' => $this->requires_acceptance,
'requires_acceptance_wording' => $this->getRequiresAcceptanceWording(),
'acceptance_url' => $this->acceptanceUrl(),
+ 'eula' => $this->getEula(),
],
);
}
@@ -85,6 +86,23 @@ class BulkAssetCheckoutMail extends Mailable
return route('account.accept.item', $this->assets->first());
}
+ private function getEula()
+ {
+ // if assets do not have the same category then return early...
+ $categories = $this->assets->pluck('model.category.id')->unique();
+
+ if ($categories->count() > 1) {
+ return;
+ }
+
+ // if assets do have the same category then return the shared EULA
+ if ($categories->count() === 1) {
+ return $this->assets->first()->getEula();
+ }
+
+ // @todo: if the categories use the default eula then return that
+ }
+
private function loadCustomFieldsOnAssets(): void
{
$this->assets = $this->assets->map(function (Asset $asset) {
diff --git a/resources/views/mail/markdown/bulk-asset-checkout-mail.blade.php b/resources/views/mail/markdown/bulk-asset-checkout-mail.blade.php
index 900a048818..6023c2a9f6 100644
--- a/resources/views/mail/markdown/bulk-asset-checkout-mail.blade.php
+++ b/resources/views/mail/markdown/bulk-asset-checkout-mail.blade.php
@@ -32,6 +32,12 @@
**{{ trans('mail.additional_notes') }}**: {{ $note }}
@endif
+@if ($eula)
+<x-mail::panel>
+ {{ $eula }}
+</x-mail::panel>
+@endif
+
<x-mail::table>
| | |
| ------------- | ------------- |