Skip to content

A free open source IT asset/license management system

fix label type values in db and defaults. update help text

Godfrey M94f44d1b7727
diff --git a/app/View/Label.php b/app/View/Label.php
index 8868306591..491d5195c9 100644
--- a/app/View/Label.php
+++ b/app/View/Label.php
@@ -119,14 +119,10 @@ 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;
}
$assetData->put('barcode2d', (object)[
'type' => $barcode2DType,
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 0000000000..0280374650
--- /dev/null
+++ b/database/migrations/2025_01_07_172419_fix_label_types_on_settings_table.php
@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ DB::table('settings')->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 d818bd5f85..6dcfee66be 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 <code>**text**</code> will be displayed as bold',
'help_blank_to_use' => 'Leave blank to use the value from <code>:setting_name</code>',
- 'help_default_will_use' => '<code>:default</code> will use the value from <code>:setting_name</code>. <br>Note that the value of the barcodes must comply with the respective barcode spec in order to be successfully generated. Please see <a href="https://snipe-it.readme.io/docs/barcodes">the documentation <i class="fa fa-external-link"></i></a> for more details. ',
+ 'help_default_will_use' => '<br>Note that the value of the barcodes must comply with the respective barcode spec in order to be successfully generated. Please see <a href="https://snipe-it.readme.io/docs/barcodes">the documentation <i class="fa fa-external-link"></i></a> 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&apos;s <strong><a href="https://console.cloud.google.com/" target="_blank">Google developer console <i class="fa fa-external-link" aria-hidden="true"></i></a></strong>.',
diff --git a/resources/views/settings/labels.blade.php b/resources/views/settings/labels.blade.php
index 46212b790d..4c01c2177d 100644
--- a/resources/views/settings/labels.blade.php
+++ b/resources/views/settings/labels.blade.php
@@ -175,10 +175,7 @@
<p class="help-block">
{{ 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').' &gt; '.trans('admin/settings/general.alt_barcode_type'),
- ])
+ trans('admin/settings/general.help_default_will_use')
!!}
</p>
</div>
@@ -218,10 +215,7 @@
<p class="help-block">
{{ 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').' &gt; '.trans('admin/settings/general.barcode_type'),
- ])
+ trans('admin/settings/general.help_default_will_use')
!!}
</p>
</div>