Merge pull request #16375 from snipe/fixes_16371_name_not_included_in_reminder_emails
Fixed #16371 - incorrect count and missing name in acceptance reminder email
This commit is contained in:
commit
1051b1d16d
2 changed files with 10 additions and 6 deletions
|
@ -70,23 +70,26 @@ class SendAcceptanceReminder extends Command
|
||||||
// The [0] is weird, but it allows for the item_count to work and grabs the appropriate info for each user.
|
// The [0] is weird, but it allows for the item_count to work and grabs the appropriate info for each user.
|
||||||
// Collapsing and flattening the collection doesn't work above.
|
// Collapsing and flattening the collection doesn't work above.
|
||||||
$acceptance = $unacceptedAssetGroup[0]['acceptance'];
|
$acceptance = $unacceptedAssetGroup[0]['acceptance'];
|
||||||
|
|
||||||
$locale = $acceptance->assignedTo?->locale;
|
$locale = $acceptance->assignedTo?->locale;
|
||||||
$email = $acceptance->assignedTo?->email;
|
$email = $acceptance->assignedTo?->email;
|
||||||
|
|
||||||
if(!$email){
|
if(!$email){
|
||||||
$no_email_list[] = [
|
$no_email_list[] = [
|
||||||
'id' => $acceptance->assignedTo->id,
|
'id' => $acceptance->assignedTo?->id,
|
||||||
'name' => $acceptance->assignedTo->present()->fullName(),
|
'name' => $acceptance->assignedTo?->present()->fullName(),
|
||||||
];
|
];
|
||||||
|
} else {
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
$item_count = $unacceptedAssetGroup->count();
|
$item_count = $unacceptedAssetGroup->count();
|
||||||
|
|
||||||
if ($locale && $email) {
|
if ($locale && $email) {
|
||||||
Mail::to($email)->send((new UnacceptedAssetReminderMail($acceptance, $item_count))->locale($locale));
|
Mail::to($email)->send((new UnacceptedAssetReminderMail($acceptance, $item_count))->locale($locale));
|
||||||
|
|
||||||
} elseif ($email) {
|
} elseif ($email) {
|
||||||
Mail::to($email)->send((new UnacceptedAssetReminderMail($acceptance, $item_count)));
|
Mail::to($email)->send((new UnacceptedAssetReminderMail($acceptance, $item_count)));
|
||||||
}
|
}
|
||||||
$count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info($count.' users notified.');
|
$this->info($count.' users notified.');
|
||||||
|
|
|
@ -19,9 +19,10 @@ class UnacceptedAssetReminderMail extends Mailable
|
||||||
*/
|
*/
|
||||||
public function __construct($checkout_info, $count)
|
public function __construct($checkout_info, $count)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->count = $count;
|
$this->count = $count;
|
||||||
$this->target = $checkout_info['acceptance']?->assignedTo;
|
$this->target = $checkout_info?->assignedTo;
|
||||||
$this->acceptance = $checkout_info['acceptance'];
|
$this->acceptance = $checkout_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue