diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php index 33160f1106..1171cdb8fd 100644 --- a/app/Http/Controllers/Assets/BulkAssetsController.php +++ b/app/Http/Controllers/Assets/BulkAssetsController.php @@ -216,22 +216,23 @@ class BulkAssetsController extends Controller if($custom_fields_present) { $asset = Asset::find($assetId); $assetCustomFields = $asset->model()->first()->fieldset; - if($assetCustomFields?->fields) { - foreach ($assetCustomFields?->fields as $field) { - if (array_key_exists($field->db_column, $this->update_array)) { - $asset->{$field->db_column} = $this->update_array[$field->db_column]; - $asset->save(); - continue; - } else { - $array = $this->update_array; - array_except($array, $field->db_column); - $asset->update($array); - //call update on parent model - $asset->save(); - } - if (!$asset->save()) { - $error_bag[] = $asset->getErrors(); - } + if($assetCustomFields?->fields) { + foreach ($assetCustomFields?->fields as $field) { + if (array_key_exists($field->db_column, $this->update_array)) { + $asset->{$field->db_column} = $this->update_array[$field->db_column]; + $asset->save(); + continue; + } else { + $array = $this->update_array; + array_except($array, $field->db_column); + // $asset->update($array); + $asset->save($array); + //call update on parent model + // $asset->save(); + } + if (!$asset->save()) { + $error_bag[] = $asset->getErrors(); + } } } } else {