Skip to content

Commit b65b315

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 13a0f49 + 745fc51 commit b65b315

File tree

7 files changed

+29
-9
lines changed

7 files changed

+29
-9
lines changed

app/Http/Controllers/Account/AcceptanceController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,15 @@ public function store(Request $request, $id) : RedirectResponse
248248

249249
// Add the attachment for the signing user into the $data array
250250
$data['file'] = $pdf_filename;
251-
251+
$locale = $assigned_user->locale;
252252
try {
253-
$assigned_user->notify(new AcceptanceAssetAcceptedToUserNotification($data));
253+
$assigned_user->notify((new AcceptanceAssetAcceptedToUserNotification($data))->locale($locale));
254254
} catch (\Exception $e) {
255255
Log::warning($e);
256256
}
257257
}
258258
try {
259-
$acceptance->notify(new AcceptanceAssetAcceptedNotification($data));
259+
$acceptance->notify((new AcceptanceAssetAcceptedNotification($data))->locale(Setting::getSettings()->locale));
260260
} catch (\Exception $e) {
261261
Log::warning($e);
262262
}

app/Listeners/CheckoutableListener.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ public function onCheckedOut($event)
9696

9797
if (!empty($to)) {
9898
try {
99-
Mail::to(array_flatten($to))->cc(array_flatten($cc))->send($mailable);
99+
Mail::to(array_flatten($to))->send($mailable->locale($notifiable->locale));
100+
Mail::to(array_flatten($cc))->send($mailable->locale(Setting::getSettings()->locale));
100101
Log::info('Checkout Mail sent to checkout target');
101102
} catch (ClientException $e) {
102103
Log::debug("Exception caught during checkout email: " . $e->getMessage());
@@ -180,7 +181,8 @@ public function onCheckedIn($event)
180181

181182
try {
182183
if (!empty($to)) {
183-
Mail::to(array_flatten($to))->cc(array_flatten($cc))->send($mailable);
184+
Mail::to(array_flatten($to))->send($mailable->locale($notifiable->locale));
185+
Mail::to(array_flatten($cc))->send($mailable->locale(Setting::getSettings()->locale));
184186
Log::info('Checkin Mail sent to CC addresses');
185187
}
186188
} catch (ClientException $e) {

app/Models/CheckoutAcceptance.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,19 @@ public function routeNotificationForMail()
3232

3333
return array_filter($recipients);
3434
}
35-
35+
public function getCheckoutableItemTypeAttribute(): string
36+
{
37+
$type = $this->checkoutable_type;
38+
39+
return match ($type) {
40+
Asset::class => trans('general.asset'),
41+
LicenseSeat::class => trans('general.license'),
42+
Accessory::class => trans('general.accessory'),
43+
Component::class => trans('general.component'),
44+
Consumable::class => trans('general.consumable'),
45+
default => class_basename($type),
46+
};
47+
}
3648
/**
3749
* The resource that was is out
3850
*

resources/views/account/accept/index.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class="table table-striped snipe-table"
3131
<thead>
3232
<tr>
3333
<th>{{ trans('general.name')}}</th>
34+
<th>{{ trans('general.type')}}</th>
3435
<th>{{ trans('general.serial_number')}}</th>
3536
<th>{{ trans('table.actions')}}</th>
3637
</tr>
@@ -40,6 +41,7 @@ class="table table-striped snipe-table"
4041
<tr>
4142
@if ($acceptance->checkoutable)
4243
<td>{{ ($acceptance->checkoutable) ? $acceptance->checkoutable->present()->name : '' }}</td>
44+
<td>{{ $acceptance->checkoutable_item_type }}</td>
4345
<td>{{ ($acceptance->checkoutable) ? $acceptance->checkoutable->serial : '' }}</td>
4446
<td><a href="{{ route('account.accept.item', $acceptance) }}" class="btn btn-default btn-sm">{{ trans('general.accept_decline') }}</a></td>
4547
@else

tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testCanBulkCheckoutAssets()
5858
$this->assertHasTheseActionLogs($asset, ['create', 'checkout']); //Note: '$this' gets auto-bound in closures, so this does work.
5959
});
6060

61-
Mail::assertSent(CheckoutAssetMail::class, 2);
61+
Mail::assertSent(CheckoutAssetMail::class, 4);
6262
Mail::assertSent(CheckoutAssetMail::class, function (CheckoutAssetMail $mail) {
6363
return $mail->hasTo('[email protected]');
6464
});

tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckinTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ public function test_admin_alert_email_sends()
5151

5252
$this->fireCheckInEvent($this->asset, $this->user);
5353

54+
Mail::assertSentCount(2);
5455
Mail::assertSent(CheckinAssetMail::class, function ($mail) {
55-
return $mail->hasTo($this->user->email) && $mail->hasCc('[email protected]');
56+
return $mail->hasTo($this->user->email);
57+
});
58+
Mail::assertSent(CheckinAssetMail::class, function ($mail) {
59+
return $mail->hasTo('[email protected]');
5660
});
5761
}
5862

tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function test_admin_alert_email_sends()
4848
$this->fireCheckoutEvent();
4949

5050
Mail::assertSent(CheckoutAssetMail::class, function (CheckoutAssetMail $mail) {
51-
return $mail->hasCc('[email protected]');
51+
return $mail->hasTo('[email protected]');
5252
});
5353
}
5454

0 commit comments

Comments
 (0)