IDEMPIERE-973 problem with searching in System Element
This commit is contained in:
parent
2a9162fec2
commit
4b3295e563
|
@ -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<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
|
||||
|
|
|
@ -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<Event>
|
|||
|
||||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue