Merge pull request #17543 from Godmartinz/salutation-target-fix

Salutation target fix
This commit is contained in:
snipe
2025-08-08 09:49:24 +01:00
committed by GitHub
4 changed files with 21 additions and 4 deletions

View File

@@ -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 = '';

View File

@@ -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();
}
}
/**

View File

@@ -1,5 +1,5 @@
@component('mail::message')
# {{ trans('mail.hello') }}{{ $target->assignedto?->present()->fullName() ? ' ' . $target->assignedto->present()->fullName() . ',' : ',' }}
# {{ trans('mail.hello').' '.$target.','}}
{{ $introduction_line }}

View File

@@ -1,5 +1,5 @@
@component('mail::message')
# {{ trans('mail.hello') }} {{ $target->present()->fullName() }},
# {{ trans('mail.hello').' '.$target.','}}
{{ trans('mail.new_item_checked') }}