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 86267529..90d3567f 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -168,6 +168,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: @@ -404,3 +405,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/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 @@ 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 @@ - +