Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/Http/Controllers/Assets/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,6 @@ public function getAssetByTag(Request $request, $tag=null) : RedirectResponse
return redirect()->route('hardware.show', $asset->id)->with('topsearch', $topsearch);
}


/**
* Return a QR code for the asset
*
Expand Down
1 change: 1 addition & 0 deletions app/View/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public function render(callable $callback = null)
if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
switch ($settings->label2_2d_target) {
case 'ht_tag': $barcode2DTarget = route('ht/assetTag', $asset->asset_tag); break;
case 'asset_tag' : $barcode2DTarget = basename(route('ht/assetTag', $asset->asset_tag)); break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this is doing - can you clarify?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so ht_tag returns a url of blah.com/ht/{asset_tag}, and basename() returns the trailing name of the path. without writing another method or route we get the value we want here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure if this is bad practice, but if I should write a getter for it I will 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so ht_tag returns a url of blah.com/ht/{asset_tag}, and basename() returns the trailing name of the path. without writing another method or route we get the value we want here.

I feel stupid for asking this, but if the info should just be an asset tag, wouldn't this work?

case 'asset_tag' : $barcode2DTarget = $asset->asset_tag; break;

case 'hardware_id':
default: $barcode2DTarget = route('hardware.show', ['hardware' => $asset->id]); break;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/settings/labels.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class="table table-striped snipe-table"
{{ Form::label('label2_2d_target', trans('admin/settings/general.label2_2d_target'), ['class'=>'control-label']) }}
</div>
<div class="col-md-9">
{{ Form::select('label2_2d_target', ['hardware_id'=>'/hardware/{id} ('.trans('admin/settings/general.default').')', 'ht_tag'=>'/ht/{asset_tag}'], old('label2_2d_target', $setting->label2_2d_target), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_2d_target' ]) }}
{{ Form::select('label2_2d_target', ['hardware_id'=>'/hardware/{id} ('.trans('admin/settings/general.default').')', 'ht_tag'=>'/ht/{asset_tag}', 'asset_tag' =>'{asset_tag}'], old('label2_2d_target', $setting->label2_2d_target), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_2d_target' ]) }}
{!! $errors->first('label2_2d_target', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
<p class="help-block">{{ trans('admin/settings/general.label2_2d_target_help') }}</p>
</div>
Expand Down
Loading