Skip to content

A free open source IT asset/license management system

fix preview and create from existing for new label creations

Godfrey M8e3115116c26
diff --git a/app/Http/Controllers/LabelsController.php b/app/Http/Controllers/LabelsController.php
index 739aa65fc2..eae3ba6be0 100755
--- a/app/Http/Controllers/LabelsController.php
+++ b/app/Http/Controllers/LabelsController.php
@@ -573,9 +573,13 @@ class LabelsController extends Controller
}
try {
- $template = $selectedLabel
- ? Label::find($selectedLabel)
- : new DefaultLabel;
+ if ($selectedLabel === 'StandardTape') {
+ $template = new PreviewTapeLabel;
+ } else {
+ $template = $selectedLabel
+ ? Label::find($selectedLabel)
+ : new DefaultLabel;
+ }
} catch (\Throwable $e) {
$template = new DefaultLabel;
$selectedLabel = 'DefaultLabel';
@@ -607,6 +611,10 @@ class LabelsController extends Controller
}
protected function previewLabelForTemplate($template)
{
+ if ($template instanceof PreviewTapeLabel) {
+ return $template;
+ }
+
$name = $template->getName();
if (str_starts_with($name, 'Tapes\\')) {
diff --git a/app/Services/CustomLabelImportValidator.php b/app/Services/CustomLabelImportValidator.php
index d2db968e3c..f8f51f3e66 100644
--- a/app/Services/CustomLabelImportValidator.php
+++ b/app/Services/CustomLabelImportValidator.php
@@ -112,7 +112,7 @@ class CustomLabelImportValidator
return [
'printable_area' => ['required', 'array'],
- 'content.barcode1D_v_align' => ['nullable', 'string', 'in:T,C,B'],
+ 'content.barcode1D_v_align' => ['nullable', 'string', 'in:T,M,B'],
'content.barcode1D_placement' => ['nullable', 'string', 'in:full_width,text_column,inline'],
'content.barcode2D_placement' => ['nullable', 'string', 'in:stacked,inline,text_column'],