Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QR Code Settings Check #16149

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion app/Http/Controllers/Assets/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public function getAssetByTag(Request $request, $tag=null) : RedirectResponse
* @param int $assetId
* @since [v1.0]
*/
public function getQrCode($assetId = null) : Response | BinaryFileResponse | string | bool
public function getQrCode($assetId = null): Response|BinaryFileResponse|string|bool
{
$settings = Setting::getSettings();

Expand All @@ -548,6 +548,9 @@ public function getQrCode($assetId = null) : Response | BinaryFileResponse | str
return response()->file($qr_file, $header);
} else {
$barcode = new \Com\Tecnick\Barcode\Barcode();
if ($settings->label2_2d_type == 'none') {
return false;
}
$barcode_obj = $barcode->getBarcodeObj($settings->label2_2d_type, route('hardware.show', $asset->id), $size['height'], $size['width'], 'black', [-2, -2, -2, -2]);
file_put_contents($qr_file, $barcode_obj->getPngData());

Expand Down
1 change: 1 addition & 0 deletions resources/lang/en-US/admin/settings/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
'labels_pagewidth' => 'Label sheet width',
'labels_pageheight' => 'Label sheet height',
'label_gutters' => 'Label spacing (inches)',
'label_qr_setting_invalid' => 'Your QR Code type is set to \'None\', but you have enabled QR Codes. Please select a QR Code type.',
'page_dimensions' => 'Page dimensions (inches)',
'label_fields' => 'Label visible fields',
'inches' => 'inches',
Expand Down
10 changes: 10 additions & 0 deletions resources/views/hardware/labels.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
.next-padding {
margin: {{ $settings->labels_pmargin_top }}in {{ $settings->labels_pmargin_right }}in {{ $settings->labels_pmargin_bottom }}in {{ $settings->labels_pmargin_left }}in;
}

.qr-warning {
color: red;
}
@media print {
.noprint {
display: none !important;
Expand All @@ -105,6 +109,12 @@
{!! $snipeSettings->show_custom_css() !!}
@endif
</style>
@if ($settings->qr_code=='1' && ($settings->label2_2d_type == 'none'))
<div class="qr-warning">
<p></p>
{{ __('admin/settings/general.label_qr_setting_invalid') }}
</div>
@endif

@foreach ($assets as $asset)
<?php $count++; ?>
Expand Down
Loading