diff --git a/org.adempiere.base/src/org/compiere/model/MTable.java b/org.adempiere.base/src/org/compiere/model/MTable.java index c14d0b7f5c..9a8a2c9f95 100644 --- a/org.adempiere.base/src/org/compiere/model/MTable.java +++ b/org.adempiere.base/src/org/compiere/model/MTable.java @@ -335,6 +335,27 @@ public class MTable extends X_AD_Table retValue = list.toArray(retValue); return retValue; } // getKeyColumns + + /** + * Get Identifier Columns of Table + * @return Identifier columns + */ + public String[] getIdentifierColumns() + { + getColumns(false); + ArrayList list = new ArrayList(); + // + for (int i = 0; i < m_columns.length; i++) + { + MColumn column = m_columns[i]; + if (column.isIdentifier()) + list.add(column.getColumnName()); + } + String[] retValue = new String[list.size()]; + retValue = list.toArray(retValue); + return retValue; + } // getIdentifierColumns + /************************************************************************** * Get PO Class Instance diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java index b05d61dafd..fe9d84a848 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java @@ -37,6 +37,7 @@ import org.adempiere.webui.window.FDialog; import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.IDColumn; import org.compiere.model.I_C_ElementValue; +import org.compiere.model.MTable; import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -120,17 +121,22 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener if (queryValue != null && queryValue.length() > 0) { - String separator = I_C_ElementValue.Table_Name.equalsIgnoreCase(p_tableName) ? "-" : "_"; - if (txt2.isVisible()) + MTable table = MTable.get(Env.getCtx(), p_tableName); + if (table.getIdentifierColumns().length > 1) { - String[] values = queryValue.split("["+separator+"]"); - if (values != null && values.length == 2) + String separator = I_C_ElementValue.Table_Name.equalsIgnoreCase(p_tableName) ? "-" : "_"; + if (txt2.isVisible()) { - txt1.setValue(values[0]); - txt2.setValue(values[1]); + String[] values = queryValue.split("["+separator+"]"); + if (values != null && values.length == 2) + { + txt1.setValue(values[0]); + txt2.setValue(values[1]); + } } - } + } + executeQuery(); renderItems(); }