Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
44dd061619
3 changed files with 25 additions and 5 deletions
|
@ -64,6 +64,7 @@ class SendAcceptanceReminder extends Command
|
||||||
->groupBy(function($item) {
|
->groupBy(function($item) {
|
||||||
return $item['acceptance']->assignedTo ? $item['acceptance']->assignedTo->id : '';
|
return $item['acceptance']->assignedTo ? $item['acceptance']->assignedTo->id : '';
|
||||||
});
|
});
|
||||||
|
$no_email_list= [];
|
||||||
|
|
||||||
foreach($unacceptedAssetGroups as $unacceptedAssetGroup) {
|
foreach($unacceptedAssetGroups as $unacceptedAssetGroup) {
|
||||||
// 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.
|
||||||
|
@ -72,7 +73,10 @@ class SendAcceptanceReminder extends Command
|
||||||
$locale = $acceptance->assignedTo?->locale;
|
$locale = $acceptance->assignedTo?->locale;
|
||||||
$email = $acceptance->assignedTo?->email;
|
$email = $acceptance->assignedTo?->email;
|
||||||
if(!$email){
|
if(!$email){
|
||||||
$this->info($acceptance->assignedTo?->present()->fullName().' has no email address.');
|
$no_email_list[] = [
|
||||||
|
'id' => $acceptance->assignedTo->id,
|
||||||
|
'name' => $acceptance->assignedTo->present()->fullName(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
$item_count = $unacceptedAssetGroup->count();
|
$item_count = $unacceptedAssetGroup->count();
|
||||||
|
|
||||||
|
@ -86,6 +90,14 @@ class SendAcceptanceReminder extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info($count.' users notified.');
|
$this->info($count.' users notified.');
|
||||||
|
$headers = ['ID', 'Name'];
|
||||||
|
$rows = [];
|
||||||
|
|
||||||
|
foreach ($no_email_list as $user) {
|
||||||
|
$rows[] = [$user['id'], $user['name']];
|
||||||
|
}
|
||||||
|
$this->info("The following users do not have an email address:");
|
||||||
|
$this->table($headers, $rows);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,11 @@ class BulkAssetsController extends Controller
|
||||||
* to someone/something.
|
* to someone/something.
|
||||||
*/
|
*/
|
||||||
if ($request->filled('status_id')) {
|
if ($request->filled('status_id')) {
|
||||||
$updated_status = Statuslabel::find($request->input('status_id'));
|
try {
|
||||||
|
$updated_status = Statuslabel::findOrFail($request->input('status_id'));
|
||||||
|
} catch (ModelNotFoundException $e) {
|
||||||
|
return redirect($bulk_back_url)->with('error', trans('admin/statuslabels/message.does_not_exist'));
|
||||||
|
}
|
||||||
|
|
||||||
// We cannot assign a non-deployable status type if the asset is already assigned.
|
// We cannot assign a non-deployable status type if the asset is already assigned.
|
||||||
// This could probably be added to a form request.
|
// This could probably be added to a form request.
|
||||||
|
@ -366,7 +370,7 @@ class BulkAssetsController extends Controller
|
||||||
// Otherwise we need to make sure the status type is still a deployable one.
|
// Otherwise we need to make sure the status type is still a deployable one.
|
||||||
if (
|
if (
|
||||||
($asset->assigned_to == '')
|
($asset->assigned_to == '')
|
||||||
|| ($updated_status->deployable == '1') && ($asset->assetstatus->deployable == '1')
|
|| ($updated_status->deployable == '1') && ($asset->assetstatus?->deployable == '1')
|
||||||
) {
|
) {
|
||||||
$this->update_array['status_id'] = $updated_status->id;
|
$this->update_array['status_id'] = $updated_status->id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,13 @@ class SendAcceptanceReminderTest extends TestCase
|
||||||
CheckoutAcceptance::factory()->pending()->create([
|
CheckoutAcceptance::factory()->pending()->create([
|
||||||
'assigned_to_id' => $userA->id,
|
'assigned_to_id' => $userA->id,
|
||||||
]);
|
]);
|
||||||
|
$headers = ['ID', 'Name'];
|
||||||
|
$rows = [
|
||||||
|
[$userA->id, $userA->present()->fullName()],
|
||||||
|
];
|
||||||
$this->artisan('snipeit:acceptance-reminder')
|
$this->artisan('snipeit:acceptance-reminder')
|
||||||
->expectsOutput($userA->present()->fullName().' has no email address.')
|
->expectsOutput("The following users do not have an email address:")
|
||||||
|
->expectsTable($headers, $rows)
|
||||||
->assertExitCode(0);
|
->assertExitCode(0);
|
||||||
|
|
||||||
Mail::assertNotSent(UnacceptedAssetReminderMail::class);
|
Mail::assertNotSent(UnacceptedAssetReminderMail::class);
|
||||||
|
|
Loading…
Add table
Reference in a new issue