Skip to content

A free open source IT asset/license management system

Display eula if it is the same for all items

Marcus Moore4f1ff328adf2
diff --git a/app/Mail/BulkAssetCheckoutMail.php b/app/Mail/BulkAssetCheckoutMail.php
index 14fb8466b9..e8d3cfbbfb 100644
--- a/app/Mail/BulkAssetCheckoutMail.php
+++ b/app/Mail/BulkAssetCheckoutMail.php
@@ -43,6 +43,7 @@ class BulkAssetCheckoutMail extends Mailable
'introduction' => $this->getIntroduction(),
'requires_acceptance' => $this->requiresAcceptance(),
'acceptance_url' => $this->acceptanceUrl(),
+ 'eula' => $this->getEula(),
],
);
}
@@ -88,4 +89,21 @@ 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
+ }
}
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 330b3361aa..79dfcc58e9 100644
--- a/resources/views/mail/markdown/bulk-asset-checkout-mail.blade.php
+++ b/resources/views/mail/markdown/bulk-asset-checkout-mail.blade.php
@@ -23,8 +23,6 @@ One or more items require acceptance.<br>
<hr>
-**{{ trans('general.administrator') }}**: {{ $admin->display_name }}
-
@if ((isset($expected_checkin)) && ($expected_checkin!=''))
**{{ trans('mail.expecting_checkin_date') }}**: {{ Helper::getFormattedDateObject($expected_checkin, 'date', false) }}
@endif
@@ -33,6 +31,12 @@ One or more items require acceptance.<br>
**{{ trans('mail.additional_notes') }}**: {{ $note }}
@endif
+@if ($eula)
+<x-mail::panel>
+ {{ $eula }}
+</x-mail::panel>
+@endif
+
<x-mail::table>
| | |
| ------------- | ------------- |
@@ -57,6 +61,8 @@ One or more items require acceptance.<br>
@endforeach
</x-mail::table>
+**{{ trans('general.administrator') }}**: {{ $admin->display_name }}
+
{{ trans('mail.best_regards') }}<br>
{{ $snipeSettings->site_name }}