Skip to content

Commit b2406b6

Browse files
authored
Merge pull request #17826 from marcusmoore/fixes/17585-accessory-checkout-amount-in-subject
Fixed #17585 - Display accessory checkout qty in subject line and intro text
2 parents c87829b + 15698d7 commit b2406b6

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

app/Mail/CheckoutAccessoryMail.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function envelope(): Envelope
4343

4444
return new Envelope(
4545
from: $from,
46-
subject: trans('mail.Accessory_Checkout_Notification'),
46+
subject: trans_choice('mail.Accessory_Checkout_Notification', $this->checkout_qty),
4747
);
4848
}
4949

@@ -83,17 +83,19 @@ public function content(): Content
8383
],
8484
);
8585
}
86+
8687
private function introductionLine(): string
8788
{
8889
if ($this->target instanceof Location) {
89-
return trans('mail.new_item_checked_location', ['location' => $this->target->name ]);
90+
return trans_choice('mail.new_item_checked_location', $this->checkout_qty, ['location' => $this->target->name]);
9091
}
92+
9193
if ($this->requiresAcceptance()) {
92-
return trans('mail.new_item_checked_with_acceptance');
94+
return trans_choice('mail.new_item_checked_with_acceptance', $this->checkout_qty);
9395
}
9496

9597
if (!$this->requiresAcceptance()) {
96-
return trans('mail.new_item_checked');
98+
return trans_choice('mail.new_item_checked', $this->checkout_qty);
9799
}
98100

99101
// we shouldn't get here but let's send a default message just in case

app/Mail/CheckoutAssetMail.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,15 @@ private function getSubject(): string
138138
private function introductionLine(): string
139139
{
140140
if ($this->firstTimeSending && $this->target instanceof Location) {
141-
return trans('mail.new_item_checked_location', ['location' => $this->target->name ]);
141+
return trans_choice('mail.new_item_checked_location', 1, ['location' => $this->target->name]);
142142
}
143+
143144
if ($this->firstTimeSending && $this->requiresAcceptance()) {
144-
return trans('mail.new_item_checked_with_acceptance');
145+
return trans_choice('mail.new_item_checked_with_acceptance', 1);
145146
}
146147

147148
if ($this->firstTimeSending && !$this->requiresAcceptance()) {
148-
return trans('mail.new_item_checked');
149+
return trans_choice('mail.new_item_checked', 1);
149150
}
150151

151152
if (!$this->firstTimeSending && $this->requiresAcceptance()) {

resources/lang/en-US/mail.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44

55
'Accessory_Checkin_Notification' => 'Accessory checked in',
6-
'Accessory_Checkout_Notification' => 'Accessory checked out',
6+
'Accessory_Checkout_Notification' => 'Accessory checked out|:count Accessories checked out',
77
'Asset_Checkin_Notification' => 'Asset checked in: :tag',
88
'Asset_Checkout_Notification' => 'Asset checked out: :tag',
99
'Confirm_Accessory_Checkin' => 'Accessory checkin confirmation',
@@ -75,9 +75,9 @@
7575
'low_inventory_alert' => 'There is :count item that is below minimum inventory or will soon be low.|There are :count items that are below minimum inventory or will soon be low.',
7676
'min_QTY' => 'Min QTY',
7777
'name' => 'Name',
78-
'new_item_checked' => 'A new item has been checked out under your name, details are below.',
79-
'new_item_checked_with_acceptance' => 'A new item has been checked out under your name that requires acceptance, details are below.',
80-
'new_item_checked_location' => 'A new item has been checked out to :location, details are below.',
78+
'new_item_checked' => 'A new item has been checked out under your name, details are below.|:count new items have been checked out under your name, details are below.',
79+
'new_item_checked_with_acceptance' => 'A new item has been checked out under your name that requires acceptance, details are below.|:count new items have been checked out under your name that requires acceptance, details are below.',
80+
'new_item_checked_location' => 'A new item has been checked out to :location, details are below.|:count new items have been checked out to :location, details are below.',
8181
'recent_item_checked' => 'An item was recently checked out under your name that requires acceptance, details are below.',
8282
'notes' => 'Notes',
8383
'password' => 'Password',

resources/views/mail/markdown/checkout-component.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@component('mail::message')
22
# {{ trans('mail.hello') }} {{ $target->assignedto->display_name }},
33

4-
{{ trans('mail.new_item_checked') }}
4+
{{ trans_choice('mail.new_item_checked', $qty) }}
55

66
@component('mail::table')
77
| | |
@@ -47,4 +47,4 @@
4747

4848
{{ $snipeSettings->site_name }}
4949

50-
@endcomponent
50+
@endcomponent

resources/views/mail/markdown/checkout-consumable.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@component('mail::message')
22
# {{ trans('mail.hello') }} {{ $target->display_name }},
33

4-
{{ trans('mail.new_item_checked') }}
4+
{{ trans_choice('mail.new_item_checked', $qty) }}
55

66

77
@component('mail::table')

resources/views/mail/markdown/checkout-license.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@component('mail::message')
22
# {{ trans('mail.hello').' '.$target.','}}
33

4-
{{ trans('mail.new_item_checked') }}
4+
{{ trans_choice('mail.new_item_checked', 1) }}
55

66
@component('mail::table')
77
| | |

0 commit comments

Comments
 (0)