Throw an error if the asset cannot be updated in the merge

This commit is contained in:
snipe 2020-11-10 04:41:40 -08:00
parent 8c19b11e73
commit a43fb060f4

View file

@ -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