Merge pull request #17543 from Godmartinz/salutation-target-fix
Salutation target fix
This commit is contained in:
@@ -24,16 +24,25 @@ class CheckoutAssetMail extends Mailable
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct(Asset $asset, $checkedOutTo, User $checkedOutBy, $acceptance, $note, bool $firstTimeSending = true)
|
||||
{
|
||||
$this->item = $asset;
|
||||
$this->admin = $checkedOutBy;
|
||||
$this->note = $note;
|
||||
$this->target = $checkedOutTo;
|
||||
$this->acceptance = $acceptance;
|
||||
|
||||
$this->settings = Setting::getSettings();
|
||||
$this->target = $checkedOutTo;
|
||||
|
||||
// Location is a target option, but there are no emails currently associated with locations.
|
||||
if($this->target instanceof User){
|
||||
$this->target = $this->target->present()?->fullName();
|
||||
}
|
||||
else if($this->target instanceof Asset){
|
||||
$this->target = $this->target->assignedto?->present()?->fullName();
|
||||
}
|
||||
|
||||
$this->last_checkout = '';
|
||||
$this->expected_checkin = '';
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\Asset;
|
||||
use App\Models\LicenseSeat;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
@@ -25,9 +26,16 @@ class CheckoutLicenseMail extends Mailable
|
||||
$this->item = $licenseSeat;
|
||||
$this->admin = $checkedOutBy;
|
||||
$this->note = $note;
|
||||
$this->target = $checkedOutTo;
|
||||
$this->acceptance = $acceptance;
|
||||
$this->settings = Setting::getSettings();
|
||||
$this->target = $checkedOutTo;
|
||||
|
||||
if($this->target instanceof User){
|
||||
$this->target = $this->target->present()?->fullName();
|
||||
}
|
||||
elseif($this->target instanceof Asset){
|
||||
$this->target = $this->target->assignedto?->present()?->fullName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@component('mail::message')
|
||||
# {{ trans('mail.hello') }}{{ $target->assignedto?->present()->fullName() ? ' ' . $target->assignedto->present()->fullName() . ',' : ',' }}
|
||||
# {{ trans('mail.hello').' '.$target.','}}
|
||||
|
||||
{{ $introduction_line }}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@component('mail::message')
|
||||
# {{ trans('mail.hello') }} {{ $target->present()->fullName() }},
|
||||
# {{ trans('mail.hello').' '.$target.','}}
|
||||
|
||||
{{ trans('mail.new_item_checked') }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user