diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index 4f3f507ffb..2087840222 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -873,6 +873,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL String s_sqlFrom = embedInfo.getFromClause(); /** Where Clause */ String s_sqlWhere = relatedInfo.getLinkColumnName() + "=?"; + String infoWhere = embedInfo.getWhereClause(); + if(!Util.isEmpty(infoWhere)) + s_sqlWhere += " AND (" + infoWhere + ")"; String s_sqlCount = "SELECT COUNT(*) FROM " + s_sqlFrom + " WHERE " + s_sqlWhere; m_sqlEmbedded = embeddedTbl.prepareTable(s_layoutEmbedded, s_sqlFrom, s_sqlWhere, false, tableName); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/RelatedInfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/RelatedInfoWindow.java index 3c6d02f196..8337748283 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/RelatedInfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/RelatedInfoWindow.java @@ -328,9 +328,22 @@ public class RelatedInfoWindow implements EventListener, Sortable long startTime = System.currentTimeMillis(); dataSql = info.getInfoSql(); + + // Other Clause and Order By clause + String otherClause = info.getInfowin().getOtherClause(); + String orderByClause = info.getInfowin().getOrderByClause(); + if (!Util.isEmpty(otherClause)) { + dataSql = dataSql + " " + otherClause; + } if (!Util.isEmpty(m_sqlUserOrder)) { dataSql = dataSql + m_sqlUserOrder; + if(!Util.isEmpty(orderByClause)) + dataSql = dataSql + orderByClause; } + else if(!Util.isEmpty(orderByClause)) { + dataSql = dataSql + " ORDER BY " + orderByClause; + } + // isHasNextPage = false; if (log.isLoggable(Level.FINER)) log.finer(dataSql);