IDEMPIERE-2207 Use of virtual column in search is broken

This commit is contained in:
Carlos Ruiz 2014-10-15 13:22:30 -05:00
parent d4e227aafe
commit 212cfc4a0f
1 changed files with 12 additions and 1 deletions

View File

@ -1108,9 +1108,20 @@ class Restriction implements Serializable
{
if (DirectWhereClause != null)
return DirectWhereClause;
// verify if is a virtual column, do not prefix tableName if this is a virtualColumn
boolean virtualColumn = false;
if (tableName != null && tableName.length() > 0) {
MTable table = MTable.get(Env.getCtx(), tableName);
for (MColumn col : table.getColumns(false)) {
if (ColumnName.equals(col.getColumnSQL())) {
virtualColumn = true;
break;
}
}
}
//
StringBuilder sb = new StringBuilder();
if (tableName != null && tableName.length() > 0)
if (!virtualColumn && tableName != null && tableName.length() > 0)
{
// Assumes - REPLACE(INITCAP(variable),'s','X') or UPPER(variable)
int pos = ColumnName.lastIndexOf('(')+1; // including (