diff --git a/app/Models/Asset.php b/app/Models/Asset.php index cbb623b67..730ac7f8c 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -487,7 +487,7 @@ class Asset extends Depreciable } elseif ($this->model->category->use_default_eula == '1') { return $Parsedown->text(e(Setting::getSettings()->default_eula_text)); } else { - return null; + return false; } } diff --git a/app/Notifications/CheckoutNotification.php b/app/Notifications/CheckoutNotification.php index e365e8a7a..b31b87f29 100644 --- a/app/Notifications/CheckoutNotification.php +++ b/app/Notifications/CheckoutNotification.php @@ -82,6 +82,7 @@ class CheckoutNotification extends Notification */ public function toMail($notifiable) { + if (class_basename(get_class($this->params['item']))=='Asset') { //TODO: Expand for non assets. $item = $this->params['item']; @@ -100,9 +101,14 @@ class CheckoutNotification extends Notification 'log_id' => $this->params['log_id'], ]; - return (new MailMessage) - ->view('emails.accept-asset', $data) - ->subject(trans('mail.Confirm_asset_delivery')); + if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance() == '1')) + || (method_exists($item, 'getEula') && ($item->getEula())) + ) { + return (new MailMessage) + ->view('emails.accept-asset', $data) + ->subject(trans('mail.Confirm_asset_delivery')); + } + }