From a43fb060f44912d076955cdb113e41224765824d Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 10 Nov 2020 04:41:40 -0800 Subject: [PATCH] Throw an error if the asset cannot be updated in the merge --- app/Console/Commands/MergeUsersByUsername.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/MergeUsersByUsername.php b/app/Console/Commands/MergeUsersByUsername.php index ded5d1986f..95278817ea 100644 --- a/app/Console/Commands/MergeUsersByUsername.php +++ b/app/Console/Commands/MergeUsersByUsername.php @@ -54,7 +54,10 @@ class MergeUsersByUsername extends Command foreach ($bad_user->assets as $asset) { $this->info( 'Updating asset '.$asset->asset_tag.' '.$asset->id.' to user '.$user->id); $asset->assigned_to = $user->id; - $asset->save(); + if (!$asset->save()) { + $this->error( 'Could not update assigned_to field on asset '.$asset->asset_tag.' '.$asset->id.' to user '.$user->id); + $this->error( 'Error saving: '.$asset->getErrors()); + } } // Walk the list of licenses