From 3b3e4b38e6a6dffd3805668c85d13a0224f9d715 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sun, 14 Jun 2015 20:45:36 +0200 Subject: [PATCH 1/4] =?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/4] =?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 @@ From dc0607c072ea2ceb9d7c5be5ea67eb9b7baa7c5e Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sat, 20 Jun 2015 23:49:49 +0200 Subject: [PATCH 3/4] =?UTF-8?q?Vytvo=C5=99en=C3=ADm=20po=C5=BEadavku=20na?= =?UTF-8?q?=20slu=C5=BEebn=C3=AD=20cestu=20se=20ode=C5=A1le=20e-mail=20spo?= =?UTF-8?q?lucestuj=C3=ADc=C3=ADm.=20closes=20#235?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../info/bukova/isspst/data/SettingsData.java | 10 ++++++ .../TripRequirementServiceImpl.java | 22 +++++++++---- .../WEB-INF/locales/zk-label.properties | 1 + src/main/webapp/settings/global/email.zul | 31 +++++++++++++++++++ 4 files changed, 58 insertions(+), 6 deletions(-) diff --git a/src/main/java/info/bukova/isspst/data/SettingsData.java b/src/main/java/info/bukova/isspst/data/SettingsData.java index b068c08b..9272a483 100644 --- a/src/main/java/info/bukova/isspst/data/SettingsData.java +++ b/src/main/java/info/bukova/isspst/data/SettingsData.java @@ -15,6 +15,7 @@ public class SettingsData { private MailMessage authReqTemplate; private MailMessage confReqTemplate; private MailMessage confReqTripPassenger; + private MailMessage reqPassenger; private Address mainAddress; private List
shippingAddrs; private String bankName; @@ -30,6 +31,7 @@ public class SettingsData { authReqTemplate = new MailMessage(); confReqTemplate = new MailMessage(); confReqTripPassenger = new MailMessage(); + reqPassenger = new MailMessage(); mainAddress = new Address(); shippingAddrs = new ArrayList
(); vehicles = new ArrayList(); @@ -160,4 +162,12 @@ public class SettingsData { public void setConfReqTripPassenger(MailMessage confReqTripPassenger) { this.confReqTripPassenger = confReqTripPassenger; } + + public MailMessage getReqPassenger() { + return reqPassenger; + } + + public void setReqPassenger(MailMessage reqPassenger) { + this.reqPassenger = reqPassenger; + } } diff --git a/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java index 0a2c823c..52f7e8da 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java @@ -77,6 +77,21 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl + @@ -91,6 +92,31 @@ + + + + + + + + + + + + + +