Skip to content

Commit

Permalink
fix: Zoom Window of Smart Browser selection. (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Jun 13, 2022
1 parent 4fce678 commit 0d80bb8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
16 changes: 9 additions & 7 deletions src/main/java/org/spin/base/util/DictionaryUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ public static String getSQLWhereClauseFromTab(Properties context, MTab tab, List
&& parentTab.getTabLevel() < tabLevel
&& !parentTab.isTranslationTab();
})
.sorted(Comparator.comparing(MTab::getSeqNo)
.thenComparing(MTab::getTabLevel)
.reversed())
.sorted(
Comparator.comparing(MTab::getSeqNo)
.thenComparing(MTab::getTabLevel)
.reversed()
)
.collect(Collectors.toList());
// Validate direct child
if(tabList.size() == 0) {
Expand Down Expand Up @@ -224,11 +226,11 @@ public static String getSQLWhereClauseFromTab(Properties context, MTab tab, List
}
}

StringBuffer where = new StringBuffer(ValueUtil.validateNull(tab.getWhereClause()));
// Set where clause for tab
if(!Util.isEmpty(tab.getWhereClause(), true)) {
whereClause.append(" AND ").append("(").append(tab.getWhereClause()).append(")");
} else {
whereClause.append(ValueUtil.validateNull(tab.getWhereClause()));
if(!Util.isEmpty(whereClause.toString(), true)) {
where.append(" AND ").append("(").append(whereClause).append(")");
return where.toString();
}
return whereClause.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1009,17 +1009,17 @@ private ListTabEntitiesResponse.Builder convertEntitiesList(Properties context,
String where = DictionaryUtil.getSQLWhereClauseFromTab(context, tab, null);
String parsedWhereClause = Env.parseContext(context, windowNo, where, false);

if(Util.isEmpty(where)
&& !Util.isEmpty(parsedWhereClause)) {
if(Util.isEmpty(parsedWhereClause)
&& !Util.isEmpty(where)) {
throw new AdempiereException("@AD_Tab_ID@ @WhereClause@ @Unparseable@");
}
Criteria criteria = request.getFilters();
StringBuffer whereClause = new StringBuffer(parsedWhereClause);
List<Object> params = new ArrayList<>();
// For dynamic condition
String dynamicWhere = ValueUtil.getWhereClauseFromCriteria(criteria, tableName, params);
if(!Util.isEmpty(dynamicWhere)) {
if(whereClause.length() > 0) {
if(!Util.isEmpty(dynamicWhere, true)) {
if(!Util.isEmpty(whereClause.toString(), true)) {
whereClause.append(" AND ");
}
// Add
Expand All @@ -1044,7 +1044,7 @@ private ListTabEntitiesResponse.Builder convertEntitiesList(Properties context,
ListTabEntitiesResponse.Builder builder = ListTabEntitiesResponse.newBuilder();
//
StringBuilder sql = new StringBuilder(DictionaryUtil.getQueryWithReferencesFromTab(tab));
if (whereClause.length() > 0) {
if (!Util.isEmpty(whereClause.toString(), true)) {
sql.append(" WHERE ").append(whereClause); // includes first AND
}
//
Expand Down

0 comments on commit 0d80bb8

Please sign in to comment.