IDEMPIERE-1388 Info Window : Adding a IsActive criteria has no effect / thanks to Nicolas Micoud (nmicoud)

This commit is contained in:
Carlos Ruiz 2013-12-24 12:24:02 -05:00
parent 8a6f3709b0
commit 7f70a69139
1 changed files with 16 additions and 3 deletions

View File

@ -73,7 +73,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
/** /**
* *
*/ */
private static final long serialVersionUID = -2133132636255923989L; private static final long serialVersionUID = -5723251182432810379L;
protected Grid parameterGrid; protected Grid parameterGrid;
private Borderlayout layout; private Borderlayout layout;
@ -339,7 +339,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
protected String getSQLWhere() { protected String getSQLWhere() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
MTable table = MTable.get(Env.getCtx(), infoWindow.getAD_Table_ID()); MTable table = MTable.get(Env.getCtx(), infoWindow.getAD_Table_ID());
if (table.get_ColumnIndex("IsActive") >=0 ) { if (!hasIsActiveEditor() && table.get_ColumnIndex("IsActive") >=0 ) {
if (p_whereClause != null && p_whereClause.trim().length() > 0) { if (p_whereClause != null && p_whereClause.trim().length() > 0) {
builder.append(" AND "); builder.append(" AND ");
} }
@ -383,7 +383,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} else if (p_whereClause != null && p_whereClause.trim().length() > 0) { } else if (p_whereClause != null && p_whereClause.trim().length() > 0) {
builder.append(" AND "); builder.append(" AND ");
if (!checkAND.isChecked()) builder.append(" ( "); if (!checkAND.isChecked()) builder.append(" ( ");
} } else if (hasIsActiveEditor() && !checkAND.isChecked()) {
builder.append(" ( ");
}
} else { } else {
builder.append(checkAND.isChecked() ? " AND " : " OR "); builder.append(checkAND.isChecked() ? " AND " : " OR ");
} }
@ -957,4 +959,15 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
return true; return true;
} // testCount } // testCount
/** Return true if there is a 'IsActive' criteria */
boolean hasIsActiveEditor() {
for (WEditor editor : editors) {
if (editor.getGridField() != null && "IsActive".equals(editor.getGridField().getColumnName())) {
return true;
}
}
return false;
}
} }