Ag. Služební cesty / Cestovní příkazy

• přidáno povinné pole Zpráva z pracovní cesty
• u existujících záznamů přidán text "Zpráva z pracovní cesty"
• upraveno rozdělení formuláře

closes #203
Verze_2.0
František Přibyl 10 years ago
parent ac90b0a2e3
commit 25c8405f03

@ -33,7 +33,7 @@ import java.util.Map;
public class Constants { public class Constants {
public final static long DB_VERSION = 3; public final static long DB_VERSION = 4;
public final static String DEF_ADMIN = "admin"; public final static String DEF_ADMIN = "admin";
public final static String DEF_ADMIN_PASSWD = "admin"; public final static String DEF_ADMIN_PASSWD = "admin";

@ -7,6 +7,15 @@ import org.zkoss.util.resource.Labels;
public class StringUtils public class StringUtils
{ {
public static boolean isNullOrEmpty(String str)
{
return ((str == null) || (str.isEmpty()));
}
public static boolean isNullOrTrimmedEmpty(String str)
{
return ((str == null) || (str.trim().isEmpty()));
}
public static String nullToEmptyString(String str) public static String nullToEmptyString(String str)
{ {

@ -1,10 +1,11 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import info.bukova.isspst.storage.EntityWithAttachment; import info.bukova.isspst.storage.EntityWithAttachment;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption; import java.math.BigDecimal;
import org.hibernate.search.annotations.Indexed; import java.util.ArrayList;
import org.hibernate.search.annotations.IndexedEmbedded; import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
@ -15,10 +16,14 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.ArrayList; import org.hibernate.annotations.LazyCollection;
import java.util.Date; import org.hibernate.annotations.LazyCollectionOption;
import java.util.List; import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
@Entity @Entity
@Table(name = "TRIP_BILL") @Table(name = "TRIP_BILL")
@ -32,6 +37,11 @@ public class TripBill extends BaseData implements EntityWithAttachment {
private Date resultMessageDate; private Date resultMessageDate;
@Column(name = "SIGN_DATE") @Column(name = "SIGN_DATE")
private Date signDate; private Date signDate;
@Column(name = "RESULT_MESSAGE")
@Field(index = Index.YES, analyze = Analyze.YES)
private String resultMessage;
@Column(name = "FREE_MEALS") @Column(name = "FREE_MEALS")
private boolean freeMeals; private boolean freeMeals;
@Column(name = "FREE_HOUSING") @Column(name = "FREE_HOUSING")
@ -85,6 +95,16 @@ public class TripBill extends BaseData implements EntityWithAttachment {
this.signDate = signDate; this.signDate = signDate;
} }
public String getResultMessage()
{
return resultMessage;
}
public void setResultMessage(String resultMessage)
{
this.resultMessage = resultMessage;
}
public boolean isFreeMeals() { public boolean isFreeMeals() {
return freeMeals; return freeMeals;
} }

@ -126,6 +126,13 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
sq.executeUpdate(); sq.executeUpdate();
} }
if (dbVersion < 4)
{
sql = "UPDATE TRIP_BILL SET RESULT_MESSAGE = 'Zpráva z pracovní cesty' WHERE (RESULT_MESSAGE Is NULL) ";
sq = this.dao.getSession().createSQLQuery(sql);
sq.executeUpdate();
}
this.updateDatabaseVersion(); this.updateDatabaseVersion();
} }
} }

@ -8,6 +8,10 @@ import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.tripbill.TripBillApprovalService; import info.bukova.isspst.services.tripbill.TripBillApprovalService;
import info.bukova.isspst.services.tripbill.TripBillService; import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.ui.FormWithUpload; import info.bukova.isspst.ui.FormWithUpload;
import java.util.ArrayList;
import java.util.List;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
@ -18,9 +22,6 @@ import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import java.util.ArrayList;
import java.util.List;
public class TripBillForm extends FormWithUpload<TripBill> { public class TripBillForm extends FormWithUpload<TripBill> {
@WireVariable @WireVariable
@ -63,8 +64,16 @@ public class TripBillForm extends FormWithUpload<TripBill> {
@Override @Override
@Command @Command
@NotifyChange("errMessages") @NotifyChange("errMessages")
public void save(@BindingParam("window") Window win) { public void save(@BindingParam("window") Window win)
{
if (StringUtils.isNullOrTrimmedEmpty(this.getDataBean().getResultMessage()))
{
Messagebox.show(StringUtils.localize("ErrFillTripBillResultMessageText"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
return;
}
final Window editWin = win; final Window editWin = win;
if (getDataBean().getApproval() == null && !isBillDisabled()) { if (getDataBean().getApproval() == null && !isBillDisabled()) {
Messagebox.show(StringUtils.localize("TripBillSaveApprove"), StringUtils.localize("TripBillSave"), Messagebox.YES Messagebox.show(StringUtils.localize("TripBillSaveApprove"), StringUtils.localize("TripBillSave"), Messagebox.YES
| Messagebox.NO, Messagebox.QUESTION, new EventListener<Event>() { | Messagebox.NO, Messagebox.QUESTION, new EventListener<Event>() {

@ -399,3 +399,5 @@ Passenger = Pasažér
ChooseThePasseger = Vyberte pasažéra ChooseThePasseger = Vyberte pasažéra
TransportMode = Způsob dopravy TransportMode = Způsob dopravy
ForeignPersons = Cizí osoby ForeignPersons = Cizí osoby
TripBillResultMessageText = Zpráva z pracovní cesty
ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty.

@ -43,35 +43,51 @@
</grid> </grid>
<grid> <grid>
<columns> <columns>
<column/> <column hflex="min" />
<column/> <column hflex="min" />
<column hflex="1" />
</columns> </columns>
<rows> <rows>
<row> <row>
<label value="${labels.TripBillResultMessage}"/> <cell>
<label value="${labels.TripBillResultMessage}" />
</cell>
<cell>
<datebox <datebox
value="@bind(vm.dataBean.resultMessageDate)" value="@bind(vm.dataBean.resultMessageDate)"
disabled="${disabled}" disabled="${disabled}"
format="${labels.DateFormat}" /> format="${labels.DateFormat}" />
</cell>
</row> </row>
<row> <row>
<cell colspan="2"> <cell rowspan="3">
<checkbox label="${labels.TripBillFreeMeals}" <textbox
placeholder="${labels.TripBillResultMessageText}"
value="@bind(vm.dataBean.resultMessage)"
style="resize:none"
rows="3"
cols="80" />
</cell>
<cell>
<checkbox
label="${labels.TripBillFreeMeals}"
checked="@bind(vm.dataBean.freeMeals)" checked="@bind(vm.dataBean.freeMeals)"
onCheck="@command('calculate')" onCheck="@command('calculate')"
disabled="@load(vm.billDisabled or disabled)"/> disabled="@load(vm.billDisabled or disabled)" />
</cell> </cell>
</row> </row>
<row> <row>
<cell colspan="2"> <cell>
<checkbox label="${labels.TripBillFreeHousing}" <checkbox
label="${labels.TripBillFreeHousing}"
checked="@bind(vm.dataBean.freeHousing)" checked="@bind(vm.dataBean.freeHousing)"
disabled="@load(vm.billDisabled or disabled)" /> disabled="@load(vm.billDisabled or disabled)" />
</cell> </cell>
</row> </row>
<row> <row>
<cell colspan="2"> <cell>
<checkbox label="${labels.TripBillFreeCarfare}" <checkbox
label="${labels.TripBillFreeCarfare}"
checked="@bind(vm.dataBean.freeCarfare)" checked="@bind(vm.dataBean.freeCarfare)"
disabled="@load(vm.billDisabled or disabled)" /> disabled="@load(vm.billDisabled or disabled)" />
</cell> </cell>

Loading…
Cancel
Save