From 3b3e4b38e6a6dffd3805668c85d13a0224f9d715 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sun, 14 Jun 2015 20:45:36 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Vy=C3=BA=C4=8Dtov=C3=A1n=C3=AD=20slu=C5=BEe?= =?UTF-8?q?bn=C3=AD=20cesty=20nelze=20odeslat=20ke=20schv=C3=A1len=C3=AD,?= =?UTF-8?q?=20pokud=20nejsou=20vypln=C4=9Bn=C3=A9=20=C4=8Dasy=20odjezdu=20?= =?UTF-8?q?a=20p=C5=99=C3=ADjezdu.=20closes=20#230?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../isspst/ui/tripbill/TripBillForm.java | 25 ++++++++++++++++--- .../WEB-INF/locales/zk-label.properties | 2 ++ src/main/webapp/settings/global/email.zul | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/main/java/info/bukova/isspst/ui/tripbill/TripBillForm.java b/src/main/java/info/bukova/isspst/ui/tripbill/TripBillForm.java index 286269a6..1f2cfdbe 100644 --- a/src/main/java/info/bukova/isspst/ui/tripbill/TripBillForm.java +++ b/src/main/java/info/bukova/isspst/ui/tripbill/TripBillForm.java @@ -3,6 +3,7 @@ package info.bukova.isspst.ui.tripbill; import info.bukova.isspst.StringUtils; import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBillApproval; +import info.bukova.isspst.data.TripBillItem; import info.bukova.isspst.data.Vehicle; import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.tripbill.TripBillApprovalService; @@ -66,9 +67,7 @@ public class TripBillForm extends FormWithUpload { @NotifyChange("errMessages") public void saveForApproval(@BindingParam("window") Window win) { - if (StringUtils.isNullOrTrimmedEmpty(this.getDataBean().getResultMessage())) - { - Messagebox.show(StringUtils.localize("ErrFillTripBillResultMessageText"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR); + if (!canSaveForApproval()) { return; } @@ -94,6 +93,26 @@ public class TripBillForm extends FormWithUpload { } + private boolean canSaveForApproval() { + if (StringUtils.isNullOrTrimmedEmpty(this.getDataBean().getResultMessage())) { + Messagebox.show(StringUtils.localize("ErrFillTripBillResultMessageText"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR); + return false; + } + + if (getDataBean().getBillItems() != null && !getDataBean().getBillItems().isEmpty()) { + TripBillItem first = getDataBean().getBillItems().get(0); + TripBillItem last = getDataBean().getBillItems().get(getDataBean().getBillItems().size() - 1); + + if (first.getToArrival() == null || first.getToDeparture() == null + || last.getBackArrival() == null || last.getBackDeparture() == null) { + Messagebox.show(StringUtils.localize("ErrFillTripBillResultTimes"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR); + return false; + } + } + + return true; + } + @Override protected void doSave() { maintainAttachment(); diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index a6754a1e..eaed015c 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -167,6 +167,7 @@ EMails=E-maily NewRequirement=Nový požadavek AuthRequirement=Dílčí schválení ConfirmRequirement=Schválení +ConfirmTripPassengers=Schválení SC - spolucestující InsertField=Vložit pole EnableRequirements=Povolit zadávání požadavků ShippingAddresses=Dodací adresy: @@ -403,3 +404,4 @@ TransportMode = Způsob dopravy ForeignPersons = Cizí osoby TripBillResultMessageText = Zpráva z pracovní cesty ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty. +ErrFillTripBillResultTimes = Zadejte časy odjezdu a příjezdu. diff --git a/src/main/webapp/settings/global/email.zul b/src/main/webapp/settings/global/email.zul index e8ac7caf..73c2afed 100644 --- a/src/main/webapp/settings/global/email.zul +++ b/src/main/webapp/settings/global/email.zul @@ -7,7 +7,7 @@ - + From 4d74b0a3fe9c0879ff66347415e051e07c9407ba Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Mon, 15 Jun 2015 21:17:17 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Opraven=20binding=20formul=C3=A1=C5=99e=20v?= =?UTF-8?q?y=C3=BA=C4=8Dtov=C3=A1n=C3=AD=20slu=C5=BEebn=C3=AD=20cesty.=20c?= =?UTF-8?q?loses=20#231?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/webapp/main/trips/tripBillInterior.zul | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/main/trips/tripBillInterior.zul b/src/main/webapp/main/trips/tripBillInterior.zul index 676747a0..f9d29037 100644 --- a/src/main/webapp/main/trips/tripBillInterior.zul +++ b/src/main/webapp/main/trips/tripBillInterior.zul @@ -341,13 +341,13 @@