diff --git a/org.adempiere.base/src/org/adempiere/util/AbstractDocumentSearch.java b/org.adempiere.base/src/org/adempiere/util/AbstractDocumentSearch.java index 62e70632c5..a02e5cca35 100644 --- a/org.adempiere.base/src/org/adempiere/util/AbstractDocumentSearch.java +++ b/org.adempiere.base/src/org/adempiere/util/AbstractDocumentSearch.java @@ -155,6 +155,7 @@ public abstract class AbstractDocumentSearch { } else { 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) { sqlPO = new StringBuilder(sqlSO.toString()).append(" AND IsSOTrx='N'"); @@ -177,7 +178,7 @@ public abstract class AbstractDocumentSearch { } // SearchDefinition with a special 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); // count '?' in statement int count = 1; @@ -190,7 +191,7 @@ public abstract class AbstractDocumentSearch { if (msd.getDataType().equals(MSearchDefinition.DATATYPE_INTEGER)) { pstmtSO.setInt(i, Integer.valueOf(searchString.replaceAll("\\D", ""))); } else if (msd.getDataType().equals(MSearchDefinition.DATATYPE_STRING)) { - pstmtSO.setString(i, searchString); + pstmtSO.setString(i, searchString + "%"); } } }