Another attempt for #4165

(This is terrible and needs to be refactored.)
This commit is contained in:
snipe 2017-10-11 15:33:53 -07:00
parent af69f7636b
commit 7617fda978
2 changed files with 28 additions and 20 deletions

View file

@ -487,7 +487,7 @@ class Asset extends Depreciable
} elseif ($this->model->category->use_default_eula == '1') { } elseif ($this->model->category->use_default_eula == '1') {
return $Parsedown->text(e(Setting::getSettings()->default_eula_text)); return $Parsedown->text(e(Setting::getSettings()->default_eula_text));
} else { } else {
return null; return false;
} }
} }

View file

@ -83,6 +83,8 @@ class CheckoutNotification extends Notification
public function toMail($notifiable) public function toMail($notifiable)
{ {
if (class_basename(get_class($this->params['item']))=='Asset') {
//TODO: Expand for non assets. //TODO: Expand for non assets.
$item = $this->params['item']; $item = $this->params['item'];
$admin_user = $this->params['admin']; $admin_user = $this->params['admin'];
@ -100,10 +102,16 @@ class CheckoutNotification extends Notification
'log_id' => $this->params['log_id'], 'log_id' => $this->params['log_id'],
]; ];
if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance() == '1'))
|| (method_exists($item, 'getEula') && ($item->getEula()))
) {
return (new MailMessage) return (new MailMessage)
->view('emails.accept-asset', $data) ->view('emails.accept-asset', $data)
->subject(trans('mail.Confirm_asset_delivery')); ->subject(trans('mail.Confirm_asset_delivery'));
}
}