IDEMPIERE-973 problem with searching in System Element

This commit is contained in:
Richard Morales 2013-05-28 21:09:07 -05:00
parent 2a9162fec2
commit 4b3295e563
2 changed files with 34 additions and 7 deletions

View File

@ -336,6 +336,27 @@ public class MTable extends X_AD_Table
return retValue; return retValue;
} // getKeyColumns } // getKeyColumns
/**
* Get Identifier Columns of Table
* @return Identifier columns
*/
public String[] getIdentifierColumns()
{
getColumns(false);
ArrayList<String> list = new ArrayList<String>();
//
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 * Get PO Class Instance
* @param Record_ID record * @param Record_ID record

View File

@ -37,6 +37,7 @@ import org.adempiere.webui.window.FDialog;
import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.model.I_C_ElementValue; import org.compiere.model.I_C_ElementValue;
import org.compiere.model.MTable;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -120,15 +121,20 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
if (queryValue != null && queryValue.length() > 0) if (queryValue != null && queryValue.length() > 0)
{ {
String separator = I_C_ElementValue.Table_Name.equalsIgnoreCase(p_tableName) ? "-" : "_"; MTable table = MTable.get(Env.getCtx(), p_tableName);
if (txt2.isVisible()) if (table.getIdentifierColumns().length > 1)
{ {
String[] values = queryValue.split("["+separator+"]"); String separator = I_C_ElementValue.Table_Name.equalsIgnoreCase(p_tableName) ? "-" : "_";
if (values != null && values.length == 2) if (txt2.isVisible())
{ {
txt1.setValue(values[0]); String[] values = queryValue.split("["+separator+"]");
txt2.setValue(values[1]); if (values != null && values.length == 2)
{
txt1.setValue(values[0]);
txt2.setValue(values[1]);
}
} }
} }
executeQuery(); executeQuery();