From 095089d020595f6b8c20ca9661ba6d85e144f7d0 Mon Sep 17 00:00:00 2001 From: Franta Pribyl Date: Mon, 5 Oct 2015 08:32:42 +0200 Subject: [PATCH] =?UTF-8?q?U=20po=C5=BEadavk=C5=AF=20na=20n=C3=A1kup=20je?= =?UTF-8?q?=20nyn=C3=AD=20pole=20Popis=20povinn=C3=A9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #248 --- .../validators/RequirementFormValidator.java | 23 +++++++++++++++---- .../WEB-INF/locales/zk-label.properties | 3 +++ .../main/orders/requirements/reqForm.zul | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/info/bukova/isspst/validators/RequirementFormValidator.java b/src/main/java/info/bukova/isspst/validators/RequirementFormValidator.java index 57e7dd55..df3532d2 100644 --- a/src/main/java/info/bukova/isspst/validators/RequirementFormValidator.java +++ b/src/main/java/info/bukova/isspst/validators/RequirementFormValidator.java @@ -22,12 +22,25 @@ public class RequirementFormValidator extends BaseValidator public void validate(ValidationContext ctx) { Property propertyCentre = ctx.getProperties("centre")[0]; - Workgroup workgroup = (Workgroup) propertyCentre.getValue(); - if (workgroup == null) - { - this.errorMsg(ctx, StringUtils.localize("RequirementCenterIsEmpty"), "idReqCenter"); - return; + if (propertyCentre != null) { + Workgroup workgroup = (Workgroup) propertyCentre.getValue(); + + if (workgroup == null) { + this.errorMsg(ctx, StringUtils.localize("RequirementCenterIsEmpty"), "idReqCenter"); + return; + } + } + + Property propertyDescription = ctx.getProperties("description")[0]; + + if (propertyDescription != null) { + String description = (String) propertyDescription.getValue(); + + if (StringUtils.isNullOrTrimmedEmpty(description)) { + this.errorMsg(ctx, StringUtils.localize("ErrMaterialOrServiceDescription"), "idDescription"); + return; + } } } } diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index d1af6cac..2e8d811e 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -419,3 +419,6 @@ ErrFillTripBillResultTimes = Zadejte časy odjezdu a příjezdu. ErrApproveMustBeSigned = Schválení musí být digitálně podepsané. DigitalSignature = Elektronický podpis ContextMenu = Volby v kontextovém menu + +ErrMaterialOrServiceDescription=Zadejte popis požadavku. + diff --git a/src/main/webapp/main/orders/requirements/reqForm.zul b/src/main/webapp/main/orders/requirements/reqForm.zul index 3030c077..a28bc640 100644 --- a/src/main/webapp/main/orders/requirements/reqForm.zul +++ b/src/main/webapp/main/orders/requirements/reqForm.zul @@ -81,7 +81,7 @@ ${labels.RequirementsFormDescription} :