diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 23bc367769..8149afc0b7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; +import java.util.Date; import java.util.Hashtable; import java.util.Iterator; import java.util.List; @@ -43,6 +44,7 @@ import org.adempiere.webui.component.Column; import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.Combobox; import org.adempiere.webui.component.ConfirmPanel; +import org.adempiere.webui.component.DatetimeBox; import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.ListCell; @@ -96,6 +98,7 @@ import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Center; import org.zkoss.zul.Comboitem; +import org.zkoss.zul.Datebox; import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; import org.zkoss.zul.South; @@ -1331,7 +1334,24 @@ public class FindWindow extends Window implements EventListener, ValueCha // Value ****** ListCell cellQueryFrom = (ListCell)row.getFellow("cellQueryFrom"+row.getId()); - Object value = cellQueryFrom.getAttribute("value"); + Object value = null; + + //Allowing Date validation before save + List compoList = cellQueryFrom.getChildren(); + if(compoList.get(0) instanceof Datebox) { + Datebox dbox = (Datebox)compoList.get(0); + if(dbox.getValue() != null) + value = new Timestamp(((Date)dbox.getValue()).getTime()); + } + else if(compoList.get(0) instanceof DatetimeBox) { + DatetimeBox dtbox = (DatetimeBox)compoList.get(0); + if(dtbox.getValue() != null) + value = new Timestamp(((Date)dtbox.getValue()).getTime()); + } + else { + value = cellQueryFrom.getAttribute("value"); + } + if (value == null) { if(Operator.equals(MQuery.NULL) || Operator.equals(MQuery.NOT_NULL)) @@ -1369,6 +1389,24 @@ public class FindWindow extends Window implements EventListener, ValueCha if (MQuery.OPERATORS[MQuery.BETWEEN_INDEX].getValue().equals(Operator)) { ListCell cellQueryTo = (ListCell)row.getFellow("cellQueryTo"+row.getId()); + + //Allowing Date validation before save + compoList = cellQueryTo.getChildren(); + if(compoList.get(0) instanceof Datebox) { + Datebox dbox = (Datebox)compoList.get(0); + if(dbox.getValue() != null) + value2 = new Timestamp(((Date)dbox.getValue()).getTime()); + } + else if(compoList.get(0) instanceof DatetimeBox) { + DatetimeBox dtbox = (DatetimeBox)compoList.get(0); + if(dtbox.getValue() != null) + value2 = new Timestamp(((Date)dtbox.getValue()).getTime()); + } + else { + value2 = cellQueryFrom.getAttribute("value"); + } + + value2 = cellQueryTo.getAttribute("value"); if (value2 == null) continue;