A free open source IT asset/license management system
Fixes #4011 - do not send email to user on license checkout
snipefaf3802971b9
diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.phpindex 6e6b67c78b..f008dec107 100755--- a/app/Http/Controllers/LicensesController.php+++ b/app/Http/Controllers/LicensesController.php@@ -279,7 +279,7 @@ class LicensesController extends Controller// Declare the rules for the form validation$rules = [- 'note' => 'string',+ 'note' => 'string|nullable','asset_id' => 'required_without:assigned_to',];diff --git a/app/Notifications/CheckoutNotification.php b/app/Notifications/CheckoutNotification.phpindex 64fc92abce..607a91b04d 100644--- a/app/Notifications/CheckoutNotification.php+++ b/app/Notifications/CheckoutNotification.php@@ -44,7 +44,9 @@ class CheckoutNotification extends Notification}$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'))// || (method_exists($item, 'getEula') && ($item->getEula()))// ) {@@ -81,30 +83,31 @@ class CheckoutNotification extends Notification*/public function toMail($notifiable){- //TODO: Expand for non assets.- $item = $this->params['item'];- $admin_user = $this->params['admin'];- $target = $this->params['target'];- $data = [- 'eula' => method_exists($item, 'getEula') ? $item->getEula() : '',- 'first_name' => $target->present()->fullName(),- 'item_name' => $item->present()->name(),- 'checkout_date' => $item->last_checkout,- 'expected_checkin' => $item->expected_checkin,- 'item_tag' => $item->asset_tag,- 'note' => $this->params['note'],- 'item_serial' => $item->serial,- 'require_acceptance' => method_exists($item, 'requireAcceptance') ? $item->requireAcceptance() : '',- 'log_id' => $this->params['log_id'],- ];- return (new MailMessage)- ->view('emails.accept-asset', $data)- ->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'));- // });++ //TODO: Expand for non assets.+ $item = $this->params['item'];+ $admin_user = $this->params['admin'];+ $target = $this->params['target'];+ $data = [+ 'eula' => method_exists($item, 'getEula') ? $item->getEula() : '',+ 'first_name' => $target->present()->fullName(),+ 'item_name' => $item->present()->name(),+ 'checkout_date' => $item->last_checkout,+ 'expected_checkin' => $item->expected_checkin,+ 'item_tag' => $item->asset_tag,+ 'note' => $this->params['note'],+ 'item_serial' => $item->serial,+ 'require_acceptance' => method_exists($item, 'requireAcceptance') ? $item->requireAcceptance() : '',+ 'log_id' => $this->params['log_id'],+ ];++ return (new MailMessage)+ ->view('emails.accept-asset', $data)+ ->subject(trans('mail.Confirm_asset_delivery'));++++}/**