Skip to content

Commit 001e874

Browse files
committed
removed redundant code
1 parent b6965d9 commit 001e874

File tree

3 files changed

+2
-30
lines changed

3 files changed

+2
-30
lines changed

app/Http/Controllers/Assets/AssetsController.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -505,30 +505,6 @@ public function getAssetByTag(Request $request, $tag=null) : RedirectResponse
505505

506506
return redirect()->route('hardware.show', $asset->id)->with('topsearch', $topsearch);
507507
}
508-
/**
509-
* Searches the assets table by asset tag, and redirects if it finds one
510-
*
511-
* @author [A. Gianotto] [<[email protected]>]
512-
* @since [v3.0]
513-
* @return \Illuminate\Http\RedirectResponse
514-
*/
515-
public function getAssetTag(Request $request, $tag=null) : RedirectResponse
516-
{
517-
$tag = $tag ?: $request->get('assetTag');
518-
519-
// Search for an exact and unique asset tag match
520-
$assets = Asset::where('asset_tag', '=', $tag);
521-
522-
// If not a unique result, redirect to the index view
523-
if ($assets->count() != 1) {
524-
return redirect()->route('hardware.index')
525-
->with('search', $tag)
526-
->with('warning', trans('admin/hardware/message.does_not_exist_var', [ 'asset_tag' => $tag ]));
527-
}
528-
529-
return $assets->first()->asset_tag;
530-
}
531-
532508

533509
/**
534510
* Return a QR code for the asset

app/View/Label.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,13 @@ public function render(callable $callback = null)
125125
if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
126126
switch ($settings->label2_2d_target) {
127127
case 'ht_tag': $barcode2DTarget = route('ht/assetTag', $asset->asset_tag); break;
128-
case 'asset_tag' : $barcode2DTarget = route('assetTag', $asset->asset_tag); break;
128+
case 'asset_tag' : $barcode2DTarget = basename(route('ht/assetTag', $asset->asset_tag)); break;
129129
case 'hardware_id':
130130
default: $barcode2DTarget = route('hardware.show', ['hardware' => $asset->id]); break;
131131
}
132-
133132
$assetData->put('barcode2d', (object)[
134133
'type' => $barcode2DType,
135-
'content' => basename($barcode2DTarget),
134+
'content' => $barcode2DTarget,
136135
]);
137136
}
138137
}

routes/web/hardware.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,3 @@ function () {
177177
Route::get('ht/{any?}',
178178
[AssetsController::class, 'getAssetByTag']
179179
)->where('any', '.*')->name('ht/assetTag');
180-
Route::get('qr/{any?}',
181-
[AssetsController::class, 'getAssetTag']
182-
)->where('any', '.*')->name('assetTag');

0 commit comments

Comments
 (0)