From 5bc3ffd52d48da7e3025fda602e7921f97f98d01 Mon Sep 17 00:00:00 2001 From: Martin Grossmann Date: Tue, 3 Oct 2023 18:44:39 +0200 Subject: [PATCH] [project-base] added validation to suppliers delivery time (#2843) --- app/src/Form/Admin/ProductFormTypeExtension.php | 5 +++++ app/translations/validators.cs.po | 6 ++++++ app/translations/validators.en.po | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/app/src/Form/Admin/ProductFormTypeExtension.php b/app/src/Form/Admin/ProductFormTypeExtension.php index abc4fea697..2f2e31c7b8 100644 --- a/app/src/Form/Admin/ProductFormTypeExtension.php +++ b/app/src/Form/Admin/ProductFormTypeExtension.php @@ -175,6 +175,11 @@ private function setDisplayAvailabilityGroup(FormBuilderInterface $builder, ?Pro ->add('vendorDeliveryDate', TextType::class, [ 'required' => false, 'label' => t('Supplier\'s delivery time'), + 'constraints' => [ + new Constraints\Type(['type' => 'numeric', 'message' => 'Supplier\'s delivery time must be a number']), + new Constraints\GreaterThanOrEqual(['value' => 0, 'message' => 'Supplier\'s delivery time must be 0 or more']), + ], + ]) ->add('usingStock', YesNoType::class, [ 'data' => true, diff --git a/app/translations/validators.cs.po b/app/translations/validators.cs.po index 52432db1cb..e96b449dc5 100644 --- a/app/translations/validators.cs.po +++ b/app/translations/validators.cs.po @@ -316,6 +316,12 @@ msgstr "Ulice a č. popisné nesmí být delší než {{ limit }} znaků" msgid "Street name cannot be longer than {{ limit }} characters" msgstr "Název ulice nesmí být delší než {{ limit }} znaků" +msgid "Supplier's delivery time must be 0 or more" +msgstr "Dodací lhůta dodavatele musí být 0 nebo více" + +msgid "Supplier's delivery time must be a number" +msgstr "Dodací lhůta dodavatele musí být číslo" + msgid "Tax number cannot be longer than {{ limit }} characters" msgstr "DIČ nesmí být delší než {{ limit }} znaků" diff --git a/app/translations/validators.en.po b/app/translations/validators.en.po index b798b8a8da..fdb724faa7 100644 --- a/app/translations/validators.en.po +++ b/app/translations/validators.en.po @@ -316,6 +316,12 @@ msgstr "" msgid "Street name cannot be longer than {{ limit }} characters" msgstr "" +msgid "Supplier's delivery time must be 0 or more" +msgstr "" + +msgid "Supplier's delivery time must be a number" +msgstr "" + msgid "Tax number cannot be longer than {{ limit }} characters" msgstr ""