Vyúčtování služební cesty nelze odeslat ke schválení, pokud nejsou vyplněné časy odjezdu a příjezdu.
closes #230
This commit is contained in:
@@ -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<TripBill> {
|
||||
@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<TripBill> {
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user