IDEMPIERE-2342 SearchDefinition - query : could show record of other tenants / IDEMPIERE-2095 Menu Lookup return records from another client / fix for swing

This commit is contained in:
Carlos Ruiz 2014-12-03 18:24:06 -05:00
parent 49a1e31daa
commit 946fd0e942
1 changed files with 3 additions and 2 deletions

View File

@ -155,6 +155,7 @@ public abstract class AbstractDocumentSearch {
} else { } else {
sqlSO.append("WHERE UPPER(").append(column.getColumnName()).append(") LIKE UPPER(?)"); sqlSO.append("WHERE UPPER(").append(column.getColumnName()).append(") LIKE UPPER(?)");
} }
sqlSO.append(Env.parseContext(Env.getCtx(), -1, " AND AD_Client_ID=@#AD_Client_ID@", false, true));
if (msd.getPO_Window_ID() != 0) { if (msd.getPO_Window_ID() != 0) {
sqlPO = new StringBuilder(sqlSO.toString()).append(" AND IsSOTrx='N'"); sqlPO = new StringBuilder(sqlSO.toString()).append(" AND IsSOTrx='N'");
@ -177,7 +178,7 @@ public abstract class AbstractDocumentSearch {
} }
// SearchDefinition with a special query // SearchDefinition with a special query
} else if (msd.getSearchType().equals(MSearchDefinition.SEARCHTYPE_QUERY)) { } else if (msd.getSearchType().equals(MSearchDefinition.SEARCHTYPE_QUERY)) {
sqlSO = new StringBuilder().append(msd.getQuery()); sqlSO = new StringBuilder().append(Env.parseContext(Env.getCtx(), -1, msd.getQuery(), false, true));
pstmtSO = DB.prepareStatement(sqlSO.toString(), null); pstmtSO = DB.prepareStatement(sqlSO.toString(), null);
// count '?' in statement // count '?' in statement
int count = 1; int count = 1;
@ -190,7 +191,7 @@ public abstract class AbstractDocumentSearch {
if (msd.getDataType().equals(MSearchDefinition.DATATYPE_INTEGER)) { if (msd.getDataType().equals(MSearchDefinition.DATATYPE_INTEGER)) {
pstmtSO.setInt(i, Integer.valueOf(searchString.replaceAll("\\D", ""))); pstmtSO.setInt(i, Integer.valueOf(searchString.replaceAll("\\D", "")));
} else if (msd.getDataType().equals(MSearchDefinition.DATATYPE_STRING)) { } else if (msd.getDataType().equals(MSearchDefinition.DATATYPE_STRING)) {
pstmtSO.setString(i, searchString); pstmtSO.setString(i, searchString + "%");
} }
} }
} }