mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fix error handling in BulkAssetsController
Updated error handling to ensure all exceptions are properly stored in the errors array and removed unused custom_field_problem variable. Also, uncommented location assignment code in UpdateAssetAction for clearer logic.
This commit is contained in:
parent
3cf583ab03
commit
0353c7a03b
|
@ -193,7 +193,7 @@ class UpdateAssetAction
|
|||
|
||||
if ($asset->save()) {
|
||||
// check out stuff
|
||||
//$location = Location::find($asset->location_id);
|
||||
$location = Location::find($asset->location_id);
|
||||
if (!is_null($assigned_user) && ($target = User::find($assigned_user))) {
|
||||
$location = $target->location_id;
|
||||
} elseif (!is_null($assigned_asset) && ($target = Asset::find($assigned_asset))) {
|
||||
|
|
|
@ -244,9 +244,9 @@ class BulkAssetsController extends Controller
|
|||
// catch exceptions
|
||||
} catch (ValidationException $e) {
|
||||
$errors[$key] = $e->getMessage();
|
||||
|
||||
} catch (CustomFieldPermissionException $e) {
|
||||
$custom_field_problem = true;
|
||||
$errors[$key] = $e->getMessage();
|
||||
//$custom_field_problem = true;
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
$errors[$key] = trans('general.something_went_wrong');
|
||||
|
@ -255,9 +255,9 @@ class BulkAssetsController extends Controller
|
|||
if (!empty($errors)) {
|
||||
return redirect($bulk_back_url)->with('bulk_asset_errors', $errors);
|
||||
}
|
||||
if ($custom_field_problem) {
|
||||
return redirect($bulk_back_url)->with('error', trans('admin/hardware/message.update.encrypted_warning'));
|
||||
}
|
||||
//if ($custom_field_problem) {
|
||||
// return redirect($bulk_back_url)->with('error', trans('admin/hardware/message.update.encrypted_warning'));
|
||||
//}
|
||||
return redirect($bulk_back_url)->with('success', trans('bulk.update.success'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue