diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php index c49896f8..e2578193 100644 --- a/src/Entity/LabelSystem/LabelOptions.php +++ b/src/Entity/LabelSystem/LabelOptions.php @@ -28,7 +28,7 @@ use Symfony\Component\Validator\Constraints as Assert; */ class LabelOptions { - public const BARCODE_TYPES = ['none', /*'ean8',*/ 'qr', 'code39', 'datamatrix', 'code93']; + public const BARCODE_TYPES = ['none', /*'ean8',*/ 'qr', 'code39', 'datamatrix', 'code93', 'code128']; public const SUPPORTED_ELEMENTS = ['part', 'part_lot']; public const PICTURE_TYPES = ['none', 'element_picture', 'main_attachment']; diff --git a/src/Form/LabelOptionsType.php b/src/Form/LabelOptionsType.php index 36c9a126..fc99764a 100644 --- a/src/Form/LabelOptionsType.php +++ b/src/Form/LabelOptionsType.php @@ -75,6 +75,7 @@ class LabelOptionsType extends AbstractType 'choices' => [ 'label_options.barcode_type.none' => 'none', 'label_options.barcode_type.qr' => 'qr', + 'label_options.barcode_type.code128' => 'code128', 'label_options.barcode_type.code39' => 'code39', 'label_options.barcode_type.code93' => 'code93', 'label_options.barcode_type.datamatrix' => 'datamatrix', @@ -83,7 +84,7 @@ class LabelOptionsType extends AbstractType if (in_array($choice, ['qr', 'datamatrix'])) { return 'label_options.barcode_type.2D'; } - if (in_array($choice, ['code39', 'code93'])) { + if (in_array($choice, ['code39', 'code93', 'code128'])) { return 'label_options.barcode_type.1D'; } diff --git a/src/Services/LabelSystem/BarcodeGenerator.php b/src/Services/LabelSystem/BarcodeGenerator.php index 21f02ff8..507abce6 100644 --- a/src/Services/LabelSystem/BarcodeGenerator.php +++ b/src/Services/LabelSystem/BarcodeGenerator.php @@ -50,14 +50,15 @@ class BarcodeGenerator case 'code93': $type = 'C93'; break; + case 'code128': + $type = 'C128A'; + break; case 'none': return null; default: throw new \InvalidArgumentException('Unknown label type!'); } - - $bobj = $barcode->getBarcodeObj($type, $this->getContent($options, $target)); return $bobj->getSvgCode(); @@ -71,6 +72,7 @@ class BarcodeGenerator return $this->barcodeContentGenerator->getURLContent($target); case 'code39': case 'code93': + case 'code128': return $this->barcodeContentGenerator->get1DBarcodeContent($target); case 'none': return null; diff --git a/templates/LabelSystem/labels/base_label.html.twig b/templates/LabelSystem/labels/base_label.html.twig index 2e2f7e7e..4c41a048 100644 --- a/templates/LabelSystem/labels/base_label.html.twig +++ b/templates/LabelSystem/labels/base_label.html.twig @@ -18,7 +18,7 @@ {% include "LabelSystem/labels/label_page_none.html.twig" %} {% elseif options.barcodeType in ['qr', 'datamatrix'] %} {% include "LabelSystem/labels/label_page_qr.html.twig" %} - {% elseif options.barcodeType in ['code39', 'code93'] %} + {% elseif options.barcodeType in ['code39', 'code93', 'code128'] %} {% include "LabelSystem/labels/label_page_1d.html.twig" %} {% endif %} diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index 8978c08b..23197157 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -8430,5 +8430,11 @@ Element 3 Update + + + label_options.barcode_type.code128 + Code 128 (recommended) + +