IDEMPIERE-5770 - Sql clauses are not applied on Related Info Window (#1897)

* IDEMPIERE-5770 - Sql clauses are not applied on Related Info Window

* IDEMPIERE-5770 - surround where clause with parenthesis
This commit is contained in:
Peter Takács 2023-06-26 16:06:27 +02:00 committed by GitHub
parent 31b2907b0a
commit b4dcfa11d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -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);

View File

@ -328,9 +328,22 @@ public class RelatedInfoWindow implements EventListener<Event>, Sortable<Object>
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);