diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php index 158f318133bf..51892e42591b 100644 --- a/app/Http/Controllers/Assets/BulkAssetsController.php +++ b/app/Http/Controllers/Assets/BulkAssetsController.php @@ -93,41 +93,6 @@ public function edit(Request $request) $assets = Asset::with('assignedTo', 'location', 'model')->whereIn('assets.id', $asset_ids); - switch ($sort_override) { - case 'model': - $assets->OrderModels($order); - break; - case 'model_number': - $assets->OrderModelNumber($order); - break; - case 'category': - $assets->OrderCategory($order); - break; - case 'manufacturer': - $assets->OrderManufacturer($order); - break; - case 'company': - $assets->OrderCompany($order); - break; - case 'location': - $assets->OrderLocation($order); - case 'rtd_location': - $assets->OrderRtdLocation($order); - break; - case 'status_label': - $assets->OrderStatus($order); - break; - case 'supplier': - $assets->OrderSupplier($order); - break; - case 'assigned_to': - $assets->OrderAssigned($order); - break; - default: - $assets->orderBy($column_sort, $order); - break; - } - $assets = $assets->get(); $models = $assets->unique('model_id'); @@ -156,7 +121,7 @@ public function edit(Request $request) }); return view('hardware/bulk-delete')->with('assets', $assets); - + case 'restore': $this->authorize('update', Asset::class); $assets = Asset::withTrashed()->find($asset_ids); @@ -176,6 +141,41 @@ public function edit(Request $request) } } + switch ($sort_override) { + case 'model': + $assets->OrderModels($order); + break; + case 'model_number': + $assets->OrderModelNumber($order); + break; + case 'category': + $assets->OrderCategory($order); + break; + case 'manufacturer': + $assets->OrderManufacturer($order); + break; + case 'company': + $assets->OrderCompany($order); + break; + case 'location': + $assets->OrderLocation($order); + case 'rtd_location': + $assets->OrderRtdLocation($order); + break; + case 'status_label': + $assets->OrderStatus($order); + break; + case 'supplier': + $assets->OrderSupplier($order); + break; + case 'assigned_to': + $assets->OrderAssigned($order); + break; + default: + $assets->orderBy($column_sort, $order); + break; + } + return redirect()->back()->with('error', 'No action selected'); } diff --git a/app/View/Label.php b/app/View/Label.php index cf695328012b..21c839fa11b6 100644 --- a/app/View/Label.php +++ b/app/View/Label.php @@ -127,7 +127,7 @@ public function render(callable $callback = null) switch ($settings->label2_2d_target) { case 'ht_tag': $barcode2DTarget = route('ht/assetTag', $asset->asset_tag); break; case 'hardware_id': - default: $barcode2DTarget = route('hardware.show', $asset->id); break; + default: $barcode2DTarget = route('hardware.show', ['hardware' => $asset->id]); break; } $assetData->put('barcode2d', (object)[ 'type' => $barcode2DType,