File tree Expand file tree Collapse file tree 3 files changed +25
-5
lines changed Expand file tree Collapse file tree 3 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ public function handle()
6464 ->groupBy (function ($ item ) {
6565 return $ item ['acceptance ' ]->assignedTo ? $ item ['acceptance ' ]->assignedTo ->id : '' ;
6666 });
67+ $ no_email_list = [];
6768
6869 foreach ($ unacceptedAssetGroups as $ unacceptedAssetGroup ) {
6970 // 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 @@ public function handle()
7273 $ locale = $ acceptance ->assignedTo ?->locale;
7374 $ email = $ acceptance ->assignedTo ?->email;
7475 if (!$ email ){
75- $ this ->info ($ acceptance ->assignedTo ?->present()->fullName ().' has no email address. ' );
76+ $ no_email_list [] = [
77+ 'id ' => $ acceptance ->assignedTo ->id ,
78+ 'name ' => $ acceptance ->assignedTo ->present ()->fullName (),
79+ ];
7680 }
7781 $ item_count = $ unacceptedAssetGroup ->count ();
7882
@@ -86,6 +90,14 @@ public function handle()
8690 }
8791
8892 $ this ->info ($ count .' users notified. ' );
93+ $ headers = ['ID ' , 'Name ' ];
94+ $ rows = [];
95+
96+ foreach ($ no_email_list as $ user ) {
97+ $ rows [] = [$ user ['id ' ], $ user ['name ' ]];
98+ }
99+ $ this ->info ("The following users do not have an email address: " );
100+ $ this ->table ($ headers , $ rows );
89101
90102 return 0 ;
91103 }
Original file line number Diff line number Diff line change @@ -358,15 +358,19 @@ public function update(Request $request) : RedirectResponse
358358 * to someone/something.
359359 */
360360 if ($ request ->filled ('status_id ' )) {
361- $ updated_status = Statuslabel::find ($ request ->input ('status_id ' ));
361+ try {
362+ $ updated_status = Statuslabel::findOrFail ($ request ->input ('status_id ' ));
363+ } catch (ModelNotFoundException $ e ) {
364+ return redirect ($ bulk_back_url )->with ('error ' , trans ('admin/statuslabels/message.does_not_exist ' ));
365+ }
362366
363367 // We cannot assign a non-deployable status type if the asset is already assigned.
364368 // This could probably be added to a form request.
365369 // If the asset isn't assigned, we don't care what the status is.
366370 // Otherwise we need to make sure the status type is still a deployable one.
367371 if (
368372 ($ asset ->assigned_to == '' )
369- || ($ updated_status ->deployable == '1 ' ) && ($ asset ->assetstatus ->deployable == '1 ' )
373+ || ($ updated_status ->deployable == '1 ' ) && ($ asset ->assetstatus ? ->deployable == '1 ' )
370374 ) {
371375 $ this ->update_array ['status_id ' ] = $ updated_status ->id ;
372376 }
Original file line number Diff line number Diff line change @@ -43,9 +43,13 @@ public function testAcceptanceReminderCommandHandlesUserWithoutEmail()
4343 CheckoutAcceptance::factory ()->pending ()->create ([
4444 'assigned_to_id ' => $ userA ->id ,
4545 ]);
46-
46+ $ headers = ['ID ' , 'Name ' ];
47+ $ rows = [
48+ [$ userA ->id , $ userA ->present ()->fullName ()],
49+ ];
4750 $ this ->artisan ('snipeit:acceptance-reminder ' )
48- ->expectsOutput ($ userA ->present ()->fullName ().' has no email address. ' )
51+ ->expectsOutput ("The following users do not have an email address: " )
52+ ->expectsTable ($ headers , $ rows )
4953 ->assertExitCode (0 );
5054
5155 Mail::assertNotSent (UnacceptedAssetReminderMail::class);
You can’t perform that action at this time.
0 commit comments