mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Refactor UpdateAssetAction for clarity and remove comments
Removed outdated and redundant comments for improved code clarity and readability. Renamed `bulkUpdate` method to `bulkLocationUpdate` for better context and understanding.
This commit is contained in:
parent
aeb5e90037
commit
233355ab48
|
@ -40,7 +40,7 @@ class UpdateAssetAction
|
||||||
$requestable = false,
|
$requestable = false,
|
||||||
$location_id = null,
|
$location_id = null,
|
||||||
$rtd_location_id = null,
|
$rtd_location_id = null,
|
||||||
$assigned_location = null, // derp, make these work
|
$assigned_location = null,
|
||||||
$assigned_asset = null,
|
$assigned_asset = null,
|
||||||
$assigned_user = null,
|
$assigned_user = null,
|
||||||
$byod = false,
|
$byod = false,
|
||||||
|
@ -165,12 +165,6 @@ class UpdateAssetAction
|
||||||
|
|
||||||
$asset = $request->handleImages($asset);
|
$asset = $request->handleImages($asset);
|
||||||
|
|
||||||
// Update custom fields in the database.
|
|
||||||
// Validation for these fields is handlded through the AssetRequest form request
|
|
||||||
// FIXME: No idea why this is returning a Builder error on db_column_name.
|
|
||||||
// Need to investigate and fix. Using static method for now.
|
|
||||||
|
|
||||||
// the gui method
|
|
||||||
$model = $asset->model;
|
$model = $asset->model;
|
||||||
if (($model) && (isset($model->fieldset))) {
|
if (($model) && (isset($model->fieldset))) {
|
||||||
foreach ($model->fieldset->fields as $field) {
|
foreach ($model->fieldset->fields as $field) {
|
||||||
|
@ -197,7 +191,7 @@ class UpdateAssetAction
|
||||||
session()->put(['redirect_option' => $request->get('redirect_option'), 'checkout_to_type' => $request->get('checkout_to_type')]);
|
session()->put(['redirect_option' => $request->get('redirect_option'), 'checkout_to_type' => $request->get('checkout_to_type')]);
|
||||||
|
|
||||||
if ($isBulk) {
|
if ($isBulk) {
|
||||||
self::bulkUpdate($asset, $request);
|
self::bulkLocationUpdate($asset, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($asset->save()) {
|
if ($asset->save()) {
|
||||||
|
@ -225,7 +219,7 @@ class UpdateAssetAction
|
||||||
return $asset;
|
return $asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function bulkUpdate($asset, $request): void
|
private static function bulkLocationUpdate($asset, $request): void
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* We're changing the location ID - figure out which location we should apply
|
* We're changing the location ID - figure out which location we should apply
|
||||||
|
|
Loading…
Reference in a new issue