diff --git a/app/View/Label.php b/app/View/Label.php
index 886830659..c28b8a959 100644
--- a/app/View/Label.php
+++ b/app/View/Label.php
@@ -105,7 +105,7 @@ class Label implements View
}
}
- if ($settings->alt_barcode_enabled) {
+
if ($template->getSupport1DBarcode()) {
$barcode1DType = $settings->label2_1d_type;
if ($barcode1DType != 'none') {
@@ -115,25 +115,25 @@ class Label implements View
]);
}
}
- }
- if ($template->getSupport2DBarcode()) {
- $barcode2DType = $settings->label2_2d_type;
- $barcode2DType = ($barcode2DType == 'default') ?
- $settings->barcode_type :
- $barcode2DType;
- if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
- switch ($settings->label2_2d_target) {
- case 'ht_tag': $barcode2DTarget = route('ht/assetTag', $asset->asset_tag); break;
- case 'hardware_id':
- default: $barcode2DTarget = route('hardware.show', ['hardware' => $asset->id]); break;
+ if ($template->getSupport2DBarcode()) {
+ $barcode2DType = $settings->label2_2d_type;
+ if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
+ switch ($settings->label2_2d_target) {
+ case 'ht_tag':
+ $barcode2DTarget = route('ht/assetTag', $asset->asset_tag);
+ break;
+ case 'hardware_id':
+ default:
+ $barcode2DTarget = route('hardware.show', ['hardware' => $asset->id]);
+ break;
+ }
+ $assetData->put('barcode2d', (object)[
+ 'type' => $barcode2DType,
+ 'content' => $barcode2DTarget,
+ ]);
}
- $assetData->put('barcode2d', (object)[
- 'type' => $barcode2DType,
- 'content' => $barcode2DTarget,
- ]);
}
- }
$fields = $fieldDefinitions
->map(fn($field) => $field->toArray($asset))
diff --git a/database/migrations/2025_01_07_172419_fix_label_types_on_settings_table.php b/database/migrations/2025_01_07_172419_fix_label_types_on_settings_table.php
new file mode 100644
index 000000000..028037465
--- /dev/null
+++ b/database/migrations/2025_01_07_172419_fix_label_types_on_settings_table.php
@@ -0,0 +1,43 @@
+where('label2_2d_type', 'default')->update([
+ 'label2_2d_type' => 'QRCODE',
+ ]);
+
+ DB::table('settings')->where('label2_1d_type', 'default')->update([
+ 'label2_1d_type' => 'C128',
+ ]);
+
+ DB::table('settings')->whereNull('label2_2d_type')->orWhere('label2_2d_type', '')->update([
+ 'label2_2d_type' => 'none',
+ ]);
+
+ DB::table('settings')->whereNull('label2_1d_type')->orWhere('label2_1d_type', '')->update([
+ 'label2_1d_type' => 'none',
+ ]);
+
+ Schema::table('settings', function (Blueprint $table) {
+ $table->string('label2_2d_type')->default('QRCODE')->change();
+ $table->string('label2_1d_type')->default('C128')->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ //
+ }
+};
diff --git a/resources/lang/en-US/admin/settings/general.php b/resources/lang/en-US/admin/settings/general.php
index d818bd5f8..6dcfee66b 100644
--- a/resources/lang/en-US/admin/settings/general.php
+++ b/resources/lang/en-US/admin/settings/general.php
@@ -367,7 +367,7 @@ return [
'label2_fields_help' => 'Fields can be added, removed, and reordered in the left column. For each field, multiple options for Label and DataSource can be added, removed, and reordered in the right column.',
'help_asterisk_bold' => 'Text entered as **text**
will be displayed as bold',
'help_blank_to_use' => 'Leave blank to use the value from :setting_name
',
- 'help_default_will_use' => ':default
will use the value from :setting_name
.
Note that the value of the barcodes must comply with the respective barcode spec in order to be successfully generated. Please see the documentation for more details. ',
+ 'help_default_will_use' => '
Note that the value of the barcodes must comply with the respective barcode spec in order to be successfully generated. Please see the documentation for more details. ',
'default' => 'Default',
'none' => 'None',
'google_callback_help' => 'This should be entered as the callback URL in your Google OAuth app settings in your organization's Google developer console .',
diff --git a/resources/views/settings/labels.blade.php b/resources/views/settings/labels.blade.php
index 46212b790..4c01c2177 100644
--- a/resources/views/settings/labels.blade.php
+++ b/resources/views/settings/labels.blade.php
@@ -175,10 +175,7 @@
{{ trans('admin/settings/general.label2_1d_type_help') }}. {!! - trans('admin/settings/general.help_default_will_use', [ - 'default' => trans('admin/settings/general.default'), - 'setting_name' => trans('admin/settings/general.barcodes').' > '.trans('admin/settings/general.alt_barcode_type'), - ]) + trans('admin/settings/general.help_default_will_use') !!}
@@ -218,10 +215,7 @@{{ trans('admin/settings/general.label2_2d_type_help', ['current' => $setting->barcode_type]) }}. {!! - trans('admin/settings/general.help_default_will_use', [ - 'default' => trans('admin/settings/general.default'), - 'setting_name' => trans('admin/settings/general.barcodes').' > '.trans('admin/settings/general.barcode_type'), - ]) + trans('admin/settings/general.help_default_will_use') !!}