Fixes #4011 - do not send email to user on license checkout

This commit is contained in:
snipe 2017-09-29 02:00:49 -07:00
parent 7fe2a1f802
commit faf3802971
2 changed files with 29 additions and 26 deletions

View file

@ -279,7 +279,7 @@ class LicensesController extends Controller
// Declare the rules for the form validation // Declare the rules for the form validation
$rules = [ $rules = [
'note' => 'string', 'note' => 'string|nullable',
'asset_id' => 'required_without:assigned_to', 'asset_id' => 'required_without:assigned_to',
]; ];

View file

@ -44,7 +44,9 @@ class CheckoutNotification extends Notification
} }
$item = $this->params['item']; $item = $this->params['item'];
$notifyBy[]='mail'; if (class_basename(get_class($this->params['item']))!='License') {
$notifyBy[] = 'mail';
}
// if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance()=='1')) // if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance()=='1'))
// || (method_exists($item, 'getEula') && ($item->getEula())) // || (method_exists($item, 'getEula') && ($item->getEula()))
// ) { // ) {
@ -81,6 +83,7 @@ class CheckoutNotification extends Notification
*/ */
public function toMail($notifiable) public function toMail($notifiable)
{ {
//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'];
@ -97,14 +100,14 @@ class CheckoutNotification extends Notification
'require_acceptance' => method_exists($item, 'requireAcceptance') ? $item->requireAcceptance() : '', 'require_acceptance' => method_exists($item, 'requireAcceptance') ? $item->requireAcceptance() : '',
'log_id' => $this->params['log_id'], 'log_id' => $this->params['log_id'],
]; ];
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'));
// \Mail::send('emails.accept-asset', $data, function ($m) use ($target) {
// $m->to($target->email, $target->first_name . ' ' . $target->last_name);
// $m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
// $m->subject(trans('mail.Confirm_asset_delivery'));
// });
} }
/** /**