From 57d83ba9d905d9b0c39f41f74e49b288bb97a673 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 30 Aug 2023 12:08:10 +0000 Subject: [PATCH] autofixes --- Admin/Install/Media.php | 1 - Admin/Install/Media/layout01.php | 316 +++++++++++----------- Admin/Installer.php | 4 +- Controller/ApiController.php | 4 +- Models/Guidelines/GS1Datamatrix.php | 122 ++++----- Models/Image.php | 7 +- Models/Label.php | 6 +- Models/LabelLayoutMapper.php | 2 +- Models/Shape.php | 4 + Models/Text.php | 9 +- Theme/Backend/Lang/Navigation.en.lang.php | 2 +- Theme/Backend/label-render.tpl.php | 2 +- Theme/Backend/layout-item.tpl.php | 8 +- 13 files changed, 248 insertions(+), 239 deletions(-) diff --git a/Admin/Install/Media.php b/Admin/Install/Media.php index 71c4324..e3b3f2a 100644 --- a/Admin/Install/Media.php +++ b/Admin/Install/Media.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Modules\Labeling\Admin\Install; -use Modules\Labeling\Models\SettingsEnum; use phpOMS\Application\ApplicationAbstract; /** diff --git a/Admin/Install/Media/layout01.php b/Admin/Install/Media/layout01.php index 9f4074d..8ae5a25 100644 --- a/Admin/Install/Media/layout01.php +++ b/Admin/Install/Media/layout01.php @@ -1,9 +1,9 @@ -text = $item->getL11n('name1')->content; -$text->size = 80; -$text->x = $margin; -$text->y = 80 + $margin; +$text = new Text(); +$text->text = $item->getL11n('name1')->content; +$text->size = 80; +$text->x = $margin; +$text->y = 80 + $margin; $l->elements[] = $text; // sub -$text = new Text(); -$text->text = $item->getL11n('name2')->content; -$text->size = 50; -$text->x = $margin; -$text->y = 170 + $margin; +$text = new Text(); +$text->text = $item->getL11n('name2')->content; +$text->size = 50; +$text->x = $margin; +$text->y = 170 + $margin; $l->elements[] = $text; -$line = new Shape(); -$line->type = 1; +$line = new Shape(); +$line->type = 1; $line->borderThickness = 5; -$line->x = $margin; -$line->y = 200 + $margin; -$line->x2 = (int) ((37.8 * $l->width) - $margin); -$line->y2 = $line->y; -$l->elements[] = $line; +$line->x = $margin; +$line->y = 200 + $margin; +$line->x2 = (int) ((37.8 * $l->width) - $margin); +$line->y2 = $line->y; +$l->elements[] = $line; // facts // REF -$image = new Image(); -$image->src = '/Modules/Labeling/Theme/icons/iso/2493.png'; -$image->x = $margin - 15; -$image->y = 250 + $margin - 50; -$image->x2 = $image->x + 150; -$image->y2 = 75 + $image->y; +$image = new Image(); +$image->src = '/Modules/Labeling/Theme/icons/iso/2493.png'; +$image->x = $margin - 15; +$image->y = 250 + $margin - 50; +$image->x2 = $image->x + 150; +$image->y2 = 75 + $image->y; $l->elements[] = $image; -$text = new Text(); -$text->text = '0123-4567-8910'; -$text->size = 40; -$text->x = 150 + $margin; -$text->y = 290 + $margin; +$text = new Text(); +$text->text = '0123-4567-8910'; +$text->size = 40; +$text->x = 150 + $margin; +$text->y = 290 + $margin; $l->elements[] = $text; // LOT -$image = new Image(); -$image->src = '/Modules/Labeling/Theme/icons/iso/2492.png'; -$image->x = $margin - 15; -$image->y = 350 + $margin - 50; -$image->x2 = $image->x + 150; -$image->y2 = 75 + $image->y; +$image = new Image(); +$image->src = '/Modules/Labeling/Theme/icons/iso/2492.png'; +$image->x = $margin - 15; +$image->y = 350 + $margin - 50; +$image->x2 = $image->x + 150; +$image->y2 = 75 + $image->y; $l->elements[] = $image; -$text = new Text(); -$text->text = '0123-4567-8910'; -$text->size = 40; -$text->x = 150 + $margin; -$text->y = 390 + $margin; +$text = new Text(); +$text->text = '0123-4567-8910'; +$text->size = 40; +$text->x = 150 + $margin; +$text->y = 390 + $margin; $l->elements[] = $text; // SN -$image = new Image(); -$image->src = '/Modules/Labeling/Theme/icons/iso/2498.png'; -$image->x = $margin - 15; -$image->y = 450 + $margin - 50; -$image->x2 = $image->x + 150; -$image->y2 = 75 + $image->y; +$image = new Image(); +$image->src = '/Modules/Labeling/Theme/icons/iso/2498.png'; +$image->x = $margin - 15; +$image->y = 450 + $margin - 50; +$image->x2 = $image->x + 150; +$image->y2 = 75 + $image->y; $l->elements[] = $image; -$text = new Text(); -$text->text = '0123-4567-8910'; -$text->size = 40; -$text->x = 150 + $margin; -$text->y = 490 + $margin; +$text = new Text(); +$text->text = '0123-4567-8910'; +$text->size = 40; +$text->x = 150 + $margin; +$text->y = 490 + $margin; $l->elements[] = $text; // manufactured -$image = new Image(); -$image->src = '/Modules/Labeling/Theme/icons/iso/2497.png'; -$image->x = $margin - 15; -$image->y = 560 + $margin - 50; -$image->x2 = $image->x + 150; -$image->y2 = 75 + $image->y; +$image = new Image(); +$image->src = '/Modules/Labeling/Theme/icons/iso/2497.png'; +$image->x = $margin - 15; +$image->y = 560 + $margin - 50; +$image->x2 = $image->x + 150; +$image->y2 = 75 + $image->y; $l->elements[] = $image; -$text = new Text(); -$text->text = 'YYYY-MM-DD'; -$text->size = 40; -$text->x = 150 + $margin; -$text->y = 610 + $margin; +$text = new Text(); +$text->text = 'YYYY-MM-DD'; +$text->size = 40; +$text->x = 150 + $margin; +$text->y = 610 + $margin; $l->elements[] = $text; -$text = new Text(); -$text->text = 'DE'; -$text->size = 20; -$text->x = $margin + 40; -$text->y = 625 + $margin; +$text = new Text(); +$text->text = 'DE'; +$text->size = 20; +$text->x = $margin + 40; +$text->y = 625 + $margin; $l->elements[] = $text; // use by date -$image = new Image(); -$image->src = '/Modules/Labeling/Theme/icons/iso/2607.png'; -$image->x = $margin + 500; -$image->y = 540 + $margin; -$image->x2 = $image->x + 100; -$image->y2 = 75 + $image->y; +$image = new Image(); +$image->src = '/Modules/Labeling/Theme/icons/iso/2607.png'; +$image->x = $margin + 500; +$image->y = 540 + $margin; +$image->x2 = $image->x + 100; +$image->y2 = 75 + $image->y; $l->elements[] = $image; -$text = new Text(); -$text->text = 'YYYY-MM-DD'; -$text->size = 40; -$text->x = 600 + $margin; -$text->y = 610 + $margin; +$text = new Text(); +$text->text = 'YYYY-MM-DD'; +$text->size = 40; +$text->x = 600 + $margin; +$text->y = 610 + $margin; $l->elements[] = $text; // QR $qr = new Datamatrix('https://jingga.app', 200, 200); -$image = new Image(); +$image = new Image(); $image->resource = $qr->get(); -$image->x = 1000 + $margin; -$image->y = 280 + $margin - 50; -$image->x2 = $image->x + 200; -$image->y2 = 75 + $image->y; -$l->elements[] = $image; +$image->x = 1000 + $margin; +$image->y = 280 + $margin - 50; +$image->x2 = $image->x + 200; +$image->y2 = 75 + $image->y; +$l->elements[] = $image; -$text = new Text(); -$text->text = "(01)00000000000000\n(11)000000\n(17)000000\n(10)A000B0\n(21)0000"; -$text->size = 40; -$text->x = 1230 + $margin; -$text->y = 280 + $margin; +$text = new Text(); +$text->text = "(01)00000000000000\n(11)000000\n(17)000000\n(10)A000B0\n(21)0000"; +$text->size = 40; +$text->x = 1230 + $margin; +$text->y = 280 + $margin; $l->elements[] = $text; // Footer // line -$line = new Shape(); -$line->type = 1; +$line = new Shape(); +$line->type = 1; $line->borderThickness = 5; -$line->x = $margin; -$line->y = 660 + $margin; -$line->x2 = (int) ((37.8 * $l->width) - $margin); -$line->y2 = $line->y; -$l->elements[] = $line; +$line->x = $margin; +$line->y = 660 + $margin; +$line->x2 = (int) ((37.8 * $l->width) - $margin); +$line->y2 = $line->y; +$l->elements[] = $line; // manufacturer -$image = new Image(); -$image->src = '/Modules/Labeling/Theme/icons/iso/3082.png'; -$image->x = $margin - 15; -$image->y = 660 + $margin; -$image->x2 = $image->x + 150; -$image->y2 = 75 + $image->y; +$image = new Image(); +$image->src = '/Modules/Labeling/Theme/icons/iso/3082.png'; +$image->x = $margin - 15; +$image->y = 660 + $margin; +$image->x2 = $image->x + 150; +$image->y2 = 75 + $image->y; $l->elements[] = $image; // address -$text = new Text(); -$text->text = 'Jingga e. K.'; -$text->size = 30; -$text->x = 150 + $margin; -$text->y = 710 + $margin; +$text = new Text(); +$text->text = 'Jingga e. K.'; +$text->size = 30; +$text->x = 150 + $margin; +$text->y = 710 + $margin; $l->elements[] = $text; -$text = new Text(); -$text->text = 'Kirchstr. 33'; -$text->size = 30; -$text->x = 150 + $margin; -$text->y = 760 + $margin; +$text = new Text(); +$text->text = 'Kirchstr. 33'; +$text->size = 30; +$text->x = 150 + $margin; +$text->y = 760 + $margin; $l->elements[] = $text; -$text = new Text(); -$text->text = '61191 Rosbach'; -$text->size = 30; -$text->x = 150 + $margin; -$text->y = 810 + $margin; +$text = new Text(); +$text->text = '61191 Rosbach'; +$text->size = 30; +$text->x = 150 + $margin; +$text->y = 810 + $margin; $l->elements[] = $text; -$text = new Text(); -$text->text = 'Germany'; -$text->size = 30; -$text->x = 150 + $margin; -$text->y = 860 + $margin; +$text = new Text(); +$text->text = 'Germany'; +$text->size = 30; +$text->x = 150 + $margin; +$text->y = 860 + $margin; $l->elements[] = $text; // contact -$text = new Text(); -$text->text = 'www.jingga.app'; -$text->size = 30; -$text->x = 600 + $margin; -$text->y = 710 + $margin; +$text = new Text(); +$text->text = 'www.jingga.app'; +$text->size = 30; +$text->x = 600 + $margin; +$text->y = 710 + $margin; $l->elements[] = $text; -$text = new Text(); -$text->text = 'info@jingga.app'; -$text->size = 30; -$text->x = 600 + $margin; -$text->y = 760 + $margin; +$text = new Text(); +$text->text = 'info@jingga.app'; +$text->size = 30; +$text->x = 600 + $margin; +$text->y = 760 + $margin; $l->elements[] = $text; -$text = new Text(); -$text->text = '+49 0123 456789'; -$text->size = 30; -$text->x = 600 + $margin; -$text->y = 810 + $margin; +$text = new Text(); +$text->text = '+49 0123 456789'; +$text->size = 30; +$text->x = 600 + $margin; +$text->y = 810 + $margin; $l->elements[] = $text; // ce -$image = new Image(); -$image->src = '/Modules/Labeling/Theme/icons/iso/ce_mark.png'; -$image->x = 1400 + $margin; -$image->y = 680 + $margin; -$image->x2 = $image->x + 200; -$image->y2 = 200 + $image->y; +$image = new Image(); +$image->src = '/Modules/Labeling/Theme/icons/iso/ce_mark.png'; +$image->x = 1400 + $margin; +$image->y = 680 + $margin; +$image->x2 = $image->x + 200; +$image->y2 = 200 + $image->y; $l->elements[] = $image; -$text = new Text(); -$text->text = '0123'; -$text->size = 45; -$text->x = 1430 + $margin; -$text->y = 850 + $margin; +$text = new Text(); +$text->text = '0123'; +$text->size = 45; +$text->x = 1430 + $margin; +$text->y = 850 + $margin; $l->elements[] = $text; // qr $qr = new QR('https://jingga.app', 200, 200); -$image = new Image(); +$image = new Image(); $image->resource = $qr->get(); -$image->x = 1620 + $margin; -$image->y = 680 + $margin; -$image->x2 = $image->x + 180; -$image->y2 = 180 + $image->y; -$l->elements[] = $image; +$image->x = 1620 + $margin; +$image->y = 680 + $margin; +$image->x2 = $image->x + 180; +$image->y2 = 180 + $image->y; +$l->elements[] = $image; -return $l; \ No newline at end of file +return $l; diff --git a/Admin/Installer.php b/Admin/Installer.php index 288a4f8..3e051b9 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -20,9 +20,7 @@ use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpResponse; use phpOMS\Module\InstallerAbstract; use phpOMS\Module\ModuleInfo; -use phpOMS\System\MimeType; use phpOMS\Uri\HttpUri; -use phpOMS\Utils\TestUtils; /** * Installer class. @@ -67,7 +65,7 @@ final class Installer extends InstallerAbstract /** * Install default bill types * - * @param ApplicationAbstract $app Application + * @param ApplicationAbstract $app Application * @param array $layouts Default layouts * * @return array diff --git a/Controller/ApiController.php b/Controller/ApiController.php index b0cdd05..e53b30a 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -16,9 +16,9 @@ declare(strict_types=1); namespace Modules\Labeling\Controller; -use Modules\Labeling\Models\LabelLayoutMapper; use Modules\Labeling\Models\LabelLayout; use Modules\Labeling\Models\LabelLayoutL11nMapper; +use Modules\Labeling\Models\LabelLayoutMapper; use Modules\Media\Models\CollectionMapper; use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\ISO639x1Enum; @@ -97,7 +97,7 @@ final class ApiController extends Controller $labelLayout = new LabelLayout(); $labelLayout->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN); - $path = '/Modules/Labeling/Templates/' . $request->getDataString('title'); + $path = '/Modules/Labeling/Templates/' . $request->getDataString('title'); $uploadedFiles = $request->files; $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( diff --git a/Models/Guidelines/GS1Datamatrix.php b/Models/Guidelines/GS1Datamatrix.php index dee165d..bd9c2a6 100644 --- a/Models/Guidelines/GS1Datamatrix.php +++ b/Models/Guidelines/GS1Datamatrix.php @@ -19,30 +19,30 @@ namespace Modules\Labeling\Models\Guidelines; class GS1Datamatrix { private const DEFINITIONS = [ - '00' => ['title' => 'SSCC', 'FNC1' => false, 'pattern' => '^00(\d{18})$',], - '01' => ['title' => 'GTIN', 'FNC1' => false, 'pattern' => '^01(\d{14})$',], - '02' => ['title' => 'CONTENT', 'FNC1' => false, 'pattern' => '^02(\d{14})$',], - '10' => ['title' => 'BATCH/LOT', 'FNC1' => true, 'pattern' => '^10([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '11' => ['title' => 'PROD DATE', 'FNC1' => false, 'pattern' => '^11(\d{6})$',], - '12' => ['title' => 'DUE DATE', 'FNC1' => false, 'pattern' => '^12(\d{6})$',], - '13' => ['title' => 'PACK DATE', 'FNC1' => false, 'pattern' => '^13(\d{6})$',], - '15' => ['title' => 'BEST BEFORE or BEST BY', 'FNC1' => false, 'pattern' => '^15(\d{6})$',], - '16' => ['title' => 'SELL BY', 'FNC1' => false, 'pattern' => '^16(\d{6})$',], - '17' => ['title' => 'USE BY OR EXPIRY', 'FNC1' => false, 'pattern' => '^17(\d{6})$',], - '20' => ['title' => 'VARIANT', 'FNC1' => false, 'pattern' => '^20(\d{2})$',], - '21' => ['title' => 'SERIAL', 'FNC1' => true, 'pattern' => '^21([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '22' => ['title' => 'CPV', 'FNC1' => true, 'pattern' => '^22([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '235' => ['title' => 'TPX', 'FNC1' => true, 'pattern' => '^235([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,28})$',], - '240' => ['title' => 'ADDITIONAL ID', 'FNC1' => true, 'pattern' => '^240([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], - '241' => ['title' => 'CUST. PART No.', 'FNC1' => true, 'pattern' => '^241([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], - '242' => ['title' => 'MTO VARIANT', 'FNC1' => true, 'pattern' => '^242(\d{0,6})$',], - '243' => ['title' => 'PCN', 'FNC1' => true, 'pattern' => '^243([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '250' => ['title' => 'SECONDARY SERIAL', 'FNC1' => true, 'pattern' => '^250([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], - '251' => ['title' => 'REF. TO SOURCE', 'FNC1' => true, 'pattern' => '^251([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], - '253' => ['title' => 'GDTI', 'FNC1' => true, 'pattern' => '^253(\d{13})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,17})$',], - '254' => ['title' => 'GLN EXTENSION COMPONENT', 'FNC1' => true, 'pattern' => '^254([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '255' => ['title' => 'GCN', 'FNC1' => true, 'pattern' => '^255(\d{13})(\d{0,12})$',], - '30' => ['title' => 'VAR. COUNT', 'FNC1' => true, 'pattern' => '^30(\d{0,8})$',], + '00' => ['title' => 'SSCC', 'FNC1' => false, 'pattern' => '^00(\d{18})$',], + '01' => ['title' => 'GTIN', 'FNC1' => false, 'pattern' => '^01(\d{14})$',], + '02' => ['title' => 'CONTENT', 'FNC1' => false, 'pattern' => '^02(\d{14})$',], + '10' => ['title' => 'BATCH/LOT', 'FNC1' => true, 'pattern' => '^10([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '11' => ['title' => 'PROD DATE', 'FNC1' => false, 'pattern' => '^11(\d{6})$',], + '12' => ['title' => 'DUE DATE', 'FNC1' => false, 'pattern' => '^12(\d{6})$',], + '13' => ['title' => 'PACK DATE', 'FNC1' => false, 'pattern' => '^13(\d{6})$',], + '15' => ['title' => 'BEST BEFORE or BEST BY', 'FNC1' => false, 'pattern' => '^15(\d{6})$',], + '16' => ['title' => 'SELL BY', 'FNC1' => false, 'pattern' => '^16(\d{6})$',], + '17' => ['title' => 'USE BY OR EXPIRY', 'FNC1' => false, 'pattern' => '^17(\d{6})$',], + '20' => ['title' => 'VARIANT', 'FNC1' => false, 'pattern' => '^20(\d{2})$',], + '21' => ['title' => 'SERIAL', 'FNC1' => true, 'pattern' => '^21([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '22' => ['title' => 'CPV', 'FNC1' => true, 'pattern' => '^22([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '235' => ['title' => 'TPX', 'FNC1' => true, 'pattern' => '^235([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,28})$',], + '240' => ['title' => 'ADDITIONAL ID', 'FNC1' => true, 'pattern' => '^240([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], + '241' => ['title' => 'CUST. PART No.', 'FNC1' => true, 'pattern' => '^241([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], + '242' => ['title' => 'MTO VARIANT', 'FNC1' => true, 'pattern' => '^242(\d{0,6})$',], + '243' => ['title' => 'PCN', 'FNC1' => true, 'pattern' => '^243([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '250' => ['title' => 'SECONDARY SERIAL', 'FNC1' => true, 'pattern' => '^250([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], + '251' => ['title' => 'REF. TO SOURCE', 'FNC1' => true, 'pattern' => '^251([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], + '253' => ['title' => 'GDTI', 'FNC1' => true, 'pattern' => '^253(\d{13})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,17})$',], + '254' => ['title' => 'GLN EXTENSION COMPONENT', 'FNC1' => true, 'pattern' => '^254([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '255' => ['title' => 'GCN', 'FNC1' => true, 'pattern' => '^255(\d{13})(\d{0,12})$',], + '30' => ['title' => 'VAR. COUNT', 'FNC1' => true, 'pattern' => '^30(\d{0,8})$',], '3100' => ['title' => 'NET WEIGHT (kg)', 'FNC1' => false, 'pattern' => '^3100(\d{6})$',], '3101' => ['title' => 'NET WEIGHT (kg)', 'FNC1' => false, 'pattern' => '^3101(\d{6})$',], '3102' => ['title' => 'NET WEIGHT (kg)', 'FNC1' => false, 'pattern' => '^3102(\d{6})$',], @@ -361,7 +361,7 @@ class GS1Datamatrix '3693' => ['title' => 'VOLUME (yd3), log', 'FNC1' => false, 'pattern' => '^3693(\d{6})$',], '3694' => ['title' => 'VOLUME (yd3), log', 'FNC1' => false, 'pattern' => '^3694(\d{6})$',], '3695' => ['title' => 'VOLUME (yd3), log', 'FNC1' => false, 'pattern' => '^3695(\d{6})$',], - '37' => ['title' => 'COUNT', 'FNC1' => true, 'pattern' => '^37(\d{0,8})$',], + '37' => ['title' => 'COUNT', 'FNC1' => true, 'pattern' => '^37(\d{0,8})$',], '3900' => ['title' => 'AMOUNT', 'FNC1' => true, 'pattern' => '^3900(\d{0,15})$',], '3901' => ['title' => 'AMOUNT', 'FNC1' => true, 'pattern' => '^3901(\d{0,15})$',], '3902' => ['title' => 'AMOUNT', 'FNC1' => true, 'pattern' => '^3902(\d{0,15})$',], @@ -416,26 +416,26 @@ class GS1Datamatrix '3957' => ['title' => 'PRICE/UoM', 'FNC1' => true, 'pattern' => '^3957(\d{0,6})$',], '3958' => ['title' => 'PRICE/UoM', 'FNC1' => true, 'pattern' => '^3958(\d{0,6})$',], '3959' => ['title' => 'PRICE/UoM', 'FNC1' => true, 'pattern' => '^3959(\d{0,6})$',], - '400' => ['title' => 'ORDER NUMBER', 'FNC1' => true, 'pattern' => '^400([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], - '401' => ['title' => 'GINC', 'FNC1' => true, 'pattern' => '^401([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], - '402' => ['title' => 'GSIN', 'FNC1' => true, 'pattern' => '^402(\d{17})$',], - '403' => ['title' => 'ROUTE', 'FNC1' => true, 'pattern' => '^403([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], - '410' => ['title' => 'SHIP TO LOC', 'FNC1' => false, 'pattern' => '^410(\d{13})$',], - '411' => ['title' => 'BILL TO', 'FNC1' => false, 'pattern' => '^411(\d{13})$',], - '412' => ['title' => 'PURCHASE FROM', 'FNC1' => false, 'pattern' => '^412(\d{13})$',], - '413' => ['title' => 'SHIP FOR LOC', 'FNC1' => false, 'pattern' => '^413(\d{13})$',], - '414' => ['title' => 'LOC No.', 'FNC1' => false, 'pattern' => '^414(\d{13})$',], - '415' => ['title' => 'PAY TO', 'FNC1' => false, 'pattern' => '^415(\d{13})$',], - '416' => ['title' => 'PROD/SERV LOC', 'FNC1' => false, 'pattern' => '^416(\d{13})$',], - '417' => ['title' => 'PARTY', 'FNC1' => false, 'pattern' => '^417(\d{13})$',], - '420' => ['title' => 'SHIP TO POST', 'FNC1' => true, 'pattern' => '^420([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '421' => ['title' => 'SHIP TO POST', 'FNC1' => true, 'pattern' => '^421(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,9})$',], - '422' => ['title' => 'ORIGIN', 'FNC1' => true, 'pattern' => '^422(\d{3})$',], - '423' => ['title' => 'COUNTRY - INITIAL PROCESS', 'FNC1' => true, 'pattern' => '^423(\d{3})(\d{0,12})$',], - '424' => ['title' => 'COUNTRY - PROCESS', 'FNC1' => true, 'pattern' => '^424(\d{3})$',], - '425' => ['title' => 'COUNTRY - DISASSEMBLY', 'FNC1' => true, 'pattern' => '^425(\d{3})(\d{0,12})$',], - '426' => ['title' => 'COUNTRY - FULL PROCESS', 'FNC1' => true, 'pattern' => '^426(\d{3})$',], - '427' => ['title' => 'ORIGIN SUBDIVISION', 'FNC1' => true, 'pattern' => '^427([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,3})$',], + '400' => ['title' => 'ORDER NUMBER', 'FNC1' => true, 'pattern' => '^400([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], + '401' => ['title' => 'GINC', 'FNC1' => true, 'pattern' => '^401([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], + '402' => ['title' => 'GSIN', 'FNC1' => true, 'pattern' => '^402(\d{17})$',], + '403' => ['title' => 'ROUTE', 'FNC1' => true, 'pattern' => '^403([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], + '410' => ['title' => 'SHIP TO LOC', 'FNC1' => false, 'pattern' => '^410(\d{13})$',], + '411' => ['title' => 'BILL TO', 'FNC1' => false, 'pattern' => '^411(\d{13})$',], + '412' => ['title' => 'PURCHASE FROM', 'FNC1' => false, 'pattern' => '^412(\d{13})$',], + '413' => ['title' => 'SHIP FOR LOC', 'FNC1' => false, 'pattern' => '^413(\d{13})$',], + '414' => ['title' => 'LOC No.', 'FNC1' => false, 'pattern' => '^414(\d{13})$',], + '415' => ['title' => 'PAY TO', 'FNC1' => false, 'pattern' => '^415(\d{13})$',], + '416' => ['title' => 'PROD/SERV LOC', 'FNC1' => false, 'pattern' => '^416(\d{13})$',], + '417' => ['title' => 'PARTY', 'FNC1' => false, 'pattern' => '^417(\d{13})$',], + '420' => ['title' => 'SHIP TO POST', 'FNC1' => true, 'pattern' => '^420([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '421' => ['title' => 'SHIP TO POST', 'FNC1' => true, 'pattern' => '^421(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,9})$',], + '422' => ['title' => 'ORIGIN', 'FNC1' => true, 'pattern' => '^422(\d{3})$',], + '423' => ['title' => 'COUNTRY - INITIAL PROCESS', 'FNC1' => true, 'pattern' => '^423(\d{3})(\d{0,12})$',], + '424' => ['title' => 'COUNTRY - PROCESS', 'FNC1' => true, 'pattern' => '^424(\d{3})$',], + '425' => ['title' => 'COUNTRY - DISASSEMBLY', 'FNC1' => true, 'pattern' => '^425(\d{3})(\d{0,12})$',], + '426' => ['title' => 'COUNTRY - FULL PROCESS', 'FNC1' => true, 'pattern' => '^426(\d{3})$',], + '427' => ['title' => 'ORIGIN SUBDIVISION', 'FNC1' => true, 'pattern' => '^427([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,3})$',], '4300' => ['title' => 'SHIP TO COMP', 'FNC1' => true, 'pattern' => '^4300([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,35})$',], '4301' => ['title' => 'SHIP TO NAME', 'FNC1' => true, 'pattern' => '^4301([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,35})$',], '4302' => ['title' => 'SHIP TO ADD1', 'FNC1' => true, 'pattern' => '^4302([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,70})$',], @@ -489,12 +489,12 @@ class GS1Datamatrix '7038' => ['title' => 'PROCESSOR # 8', 'FNC1' => true, 'pattern' => '^7038(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,27})$',], '7039' => ['title' => 'PROCESSOR # 9', 'FNC1' => true, 'pattern' => '^7039(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,27})$',], '7040' => ['title' => 'UIC+EXT', 'FNC1' => true, 'pattern' => '^7040(\d[\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{3})$',], - '710' => ['title' => 'NHRN PZN', 'FNC1' => true, 'pattern' => '^710([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '711' => ['title' => 'NHRN CIP', 'FNC1' => true, 'pattern' => '^711([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '712' => ['title' => 'NHRN CN', 'FNC1' => true, 'pattern' => '^712([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '713' => ['title' => 'NHRN DRN', 'FNC1' => true, 'pattern' => '^713([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '714' => ['title' => 'NHRN AIM', 'FNC1' => true, 'pattern' => '^714([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], - '715' => ['title' => 'NHRN NDC', 'FNC1' => true, 'pattern' => '^714([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '710' => ['title' => 'NHRN PZN', 'FNC1' => true, 'pattern' => '^710([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '711' => ['title' => 'NHRN CIP', 'FNC1' => true, 'pattern' => '^711([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '712' => ['title' => 'NHRN CN', 'FNC1' => true, 'pattern' => '^712([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '713' => ['title' => 'NHRN DRN', 'FNC1' => true, 'pattern' => '^713([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '714' => ['title' => 'NHRN AIM', 'FNC1' => true, 'pattern' => '^714([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], + '715' => ['title' => 'NHRN NDC', 'FNC1' => true, 'pattern' => '^714([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '7230' => ['title' => 'CERT #1', 'FNC1' => true, 'pattern' => '^7230([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{2,30})$',], '7231' => ['title' => 'CERT #2', 'FNC1' => true, 'pattern' => '^7231([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{2,30})$',], '7232' => ['title' => 'CERT #3', 'FNC1' => true, 'pattern' => '^7232([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{2,30})$',], @@ -528,16 +528,16 @@ class GS1Datamatrix '8111' => ['title' => 'POINTS', 'FNC1' => true, 'pattern' => '^8111(\d{4})$',], '8112' => ['title' => '', 'FNC1' => true, 'pattern' => '^8112([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,70})$',], '8200' => ['title' => 'PRODUCT URL', 'FNC1' => true, 'pattern' => '^8200([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,70})$',], - '90' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^90([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], - '91' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^91([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], - '92' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^92([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], - '93' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^93([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], - '94' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^94([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], - '95' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^95([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], - '96' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^96([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], - '97' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^97([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], - '98' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^98([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], - '99' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^99([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], + '90' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^90([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], + '91' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^91([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], + '92' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^92([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], + '93' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^93([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], + '94' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^94([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], + '95' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^95([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], + '96' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^96([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], + '97' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^97([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], + '98' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^98([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], + '99' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^99([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], ]; public array $data = []; diff --git a/Models/Image.php b/Models/Image.php index 7bdd7d3..9fae126 100644 --- a/Models/Image.php +++ b/Models/Image.php @@ -17,13 +17,18 @@ namespace Modules\Labeling\Models; class Image { public int $x = 0; + public int $y = 0; public float $ratio = 0.0; + public int $x2 = 0; + public int $y2 = 0; public string $src = ''; + public $resource = null; + public int $color = 0; -} \ No newline at end of file +} diff --git a/Models/Label.php b/Models/Label.php index 8555326..b3ae934 100644 --- a/Models/Label.php +++ b/Models/Label.php @@ -73,9 +73,7 @@ class Label ); } } elseif ($element->type === 3) { - } elseif ($element->type === 4) { - } } elseif ($element instanceof Text) { \imagettftext($im, $element->size, 0, $element->x, $element->y, $color, $element->font, $element->text); @@ -117,7 +115,6 @@ class Label $in = $newIn; } - $cut = \imagecreatetruecolor($srcW, $srcH); \imagecopy($cut, $im, 0, 0, $element->x, $element->y, $srcW, $srcH); @@ -133,10 +130,9 @@ class Label \imagedestroy($in); \imagedestroy($cut); } else { - } } return $im; } -} \ No newline at end of file +} diff --git a/Models/LabelLayoutMapper.php b/Models/LabelLayoutMapper.php index 144a8f5..e38638a 100644 --- a/Models/LabelLayoutMapper.php +++ b/Models/LabelLayoutMapper.php @@ -38,7 +38,7 @@ final class LabelLayoutMapper extends DataMapperFactory */ public const COLUMNS = [ 'labeling_layout_id' => ['name' => 'labeling_layout_id', 'type' => 'int', 'internal' => 'id'], - 'labeling_layout_template' => ['name' => 'labeling_layout_template', 'type' => 'int', 'internal' => 'template'], + 'labeling_layout_template' => ['name' => 'labeling_layout_template', 'type' => 'int', 'internal' => 'template'], ]; /** diff --git a/Models/Shape.php b/Models/Shape.php index 56964a4..e079a85 100644 --- a/Models/Shape.php +++ b/Models/Shape.php @@ -17,13 +17,17 @@ namespace Modules\Labeling\Models; class Shape { public int $x = 0; + public int $y = 0; + public int $x2 = 0; + public int $y2 = 0; public int $type = ShapeType::RECTANGLE; public int $color = 0; + public int $borderThickness = 1; public int $fillColor = -1; diff --git a/Models/Text.php b/Models/Text.php index 991ad16..b002ebc 100644 --- a/Models/Text.php +++ b/Models/Text.php @@ -17,22 +17,29 @@ namespace Modules\Labeling\Models; class Text { public int $x = 0; + public int $y = 0; public int $x2 = 0; + public int $y2 = 0; public int $size = 11; + public string $font = __DIR__ . '/../../../Resources/fonts/lato/Lato-Regular.ttf'; public string $text = ''; + public int $color = 0; // align (-1 = start, 0 = middle, 1 = end) public int $alignX = -1; + public int $alignY = -1; public bool $bold = false; + public bool $underline = false; + public bool $italic = false; -} \ No newline at end of file +} diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php index 6924ba2..71022d4 100644 --- a/Theme/Backend/Lang/Navigation.en.lang.php +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -14,5 +14,5 @@ declare(strict_types=1); return ['Navigation' => [ 'Labeling' => 'Labeling', - 'List' => 'List', + 'List' => 'List', ]]; diff --git a/Theme/Backend/label-render.tpl.php b/Theme/Backend/label-render.tpl.php index 04410cb..c0f4035 100644 --- a/Theme/Backend/label-render.tpl.php +++ b/Theme/Backend/label-render.tpl.php @@ -1,4 +1,4 @@ -data['layout']; $template = \reset($layout->template->sources); diff --git a/Theme/Backend/layout-item.tpl.php b/Theme/Backend/layout-item.tpl.php index 0d9178e..7bec498 100644 --- a/Theme/Backend/layout-item.tpl.php +++ b/Theme/Backend/layout-item.tpl.php @@ -16,18 +16,18 @@ echo $this->data['nav']->render(); $layout = \reset($this->data['layouts']); -$media = $layout->template; +$media = $layout->template; $template = \reset($media->sources); $item = $this->data['item']; $layout = include_once $template->getAbsolutePath(); -ob_start(); +\ob_start(); \imagepng($layout->render()); -$imageData = ob_get_clean(); +$imageData = \ob_get_clean(); -$imageBase64 = base64_encode($imageData); +$imageBase64 = \base64_encode($imageData); // Get the image MIME type $imageType = 'image/png'; // Assuming JPEG format in this example