IDEMPIERE-325 AD Info Window. Fixed info invoice window regression.

This commit is contained in:
Heng Sin Low 2013-02-21 11:45:02 +08:00
parent 54883e258d
commit cba45f139b
1 changed files with 6 additions and 2 deletions

View File

@ -174,12 +174,13 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
private boolean loadInfoDefinition() { private boolean loadInfoDefinition() {
String tableName = null;
if (AD_InfoWindow_ID > 0) { if (AD_InfoWindow_ID > 0) {
infoWindow = new MInfoWindow(Env.getCtx(), AD_InfoWindow_ID, null); infoWindow = new MInfoWindow(Env.getCtx(), AD_InfoWindow_ID, null);
if (!infoWindow.isValid()) { if (!infoWindow.isValid()) {
infoWindow = null; infoWindow = null;
} else { } else {
String tableName = MTable.getTableName(Env.getCtx(), infoWindow.getAD_Table_ID()); tableName = MTable.getTableName(Env.getCtx(), infoWindow.getAD_Table_ID());
if (!tableName.equalsIgnoreCase(p_tableName)) { if (!tableName.equalsIgnoreCase(p_tableName)) {
throw new IllegalArgumentException("AD_InfoWindow.TableName <> TableName argument. ("+tableName + " <> " + p_tableName+")"); throw new IllegalArgumentException("AD_InfoWindow.TableName <> TableName argument. ("+tableName + " <> " + p_tableName+")");
} }
@ -189,12 +190,15 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
if (infoWindow != null) { if (infoWindow != null) {
if (tableName == null)
tableName = MTable.getTableName(Env.getCtx(), infoWindow.getAD_Table_ID());
AccessSqlParser sqlParser = new AccessSqlParser("SELECT * FROM " + infoWindow.getFromClause()); AccessSqlParser sqlParser = new AccessSqlParser("SELECT * FROM " + infoWindow.getFromClause());
tableInfos = sqlParser.getTableInfo(0); tableInfos = sqlParser.getTableInfo(0);
if (tableInfos[0].getSynonym() != null && tableInfos[0].getSynonym().trim().length() > 0) { if (tableInfos[0].getSynonym() != null && tableInfos[0].getSynonym().trim().length() > 0) {
p_tableName = tableInfos[0].getSynonym().trim(); p_tableName = tableInfos[0].getSynonym().trim();
if (p_whereClause != null && p_whereClause.trim().length() > 0) { if (p_whereClause != null && p_whereClause.trim().length() > 0) {
p_whereClause = p_whereClause.replace(tableInfos[0].getTableName()+".", p_tableName+"."); p_whereClause = p_whereClause.replace(tableName+".", p_tableName+".");
} }
} }