IDEMPIERE-1703 improve search panel / peer review

This commit is contained in:
Carlos Ruiz 2018-07-11 19:38:30 +02:00
parent 1ff8e68438
commit 72e7e21d28
2 changed files with 19 additions and 5 deletions

View File

@ -45,6 +45,11 @@ import org.compiere.util.ValueNamePair;
*/ */
public class MQuery implements Serializable public class MQuery implements Serializable
{ {
/**
*
*/
private static final long serialVersionUID = 481623650333512326L;
/** /**
* Get Query from Parameter * Get Query from Parameter
* @param ctx context (to determine language) * @param ctx context (to determine language)
@ -357,9 +362,6 @@ public class MQuery implements Serializable
m_TableName = MTable.getTableName (Env.getCtx(), AD_Table_ID); m_TableName = MTable.getTableName (Env.getCtx(), AD_Table_ID);
} // MQuery } // MQuery
/** Serialization Info **/
private static final long serialVersionUID = 4883859385509199306L;
/** Table Name */ /** Table Name */
private String m_TableName = ""; private String m_TableName = "";
/** PInstance */ /** PInstance */
@ -448,6 +450,11 @@ public class MQuery implements Serializable
new ValueNamePair (NULL, " NULL "), new ValueNamePair (NULL, " NULL "),
new ValueNamePair (NOT_NULL, " !NULL ") new ValueNamePair (NOT_NULL, " !NULL ")
}; };
/** Operators for encrypted fields */
public static final ValueNamePair[] OPERATORS_ENCRYPTED = new ValueNamePair[] {
new ValueNamePair (NULL, " NULL "),
new ValueNamePair (NOT_NULL, " !NULL ")
};
/** Operators for Numbers, Dates, Integers */ /** Operators for Numbers, Dates, Integers */
public static final ValueNamePair[] OPERATORS_NUMBERS = new ValueNamePair[] { public static final ValueNamePair[] OPERATORS_NUMBERS = new ValueNamePair[] {

View File

@ -675,7 +675,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
mField.getVO().FieldLength = 32767; // a conservative max literal string - like oracle extended mField.getVO().FieldLength = 32767; // a conservative max literal string - like oracle extended
mField.getVO().DisplayLength = mField.getVO().FieldLength; mField.getVO().DisplayLength = mField.getVO().FieldLength;
} }
if (mField.getVO().displayType == DisplayType.YesNo || mField.isEncrypted()) { if (mField.getVO().displayType == DisplayType.YesNo || mField.isEncrypted() || mField.isEncryptedColumn()) {
// Make Yes-No searchable as list // Make Yes-No searchable as list
GridFieldVO vo = mField.getVO(); GridFieldVO vo = mField.getVO();
GridFieldVO ynvo = vo.clone(m_simpleCtx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); GridFieldVO ynvo = vo.clone(m_simpleCtx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly);
@ -1965,12 +1965,19 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
{ {
String columnName = column.getValue().toString(); String columnName = column.getValue().toString();
int referenceType = -1; int referenceType = -1;
boolean isEncrypted = false;
if (columnName != null) { if (columnName != null) {
MTable table = MTable.get(Env.getCtx(), m_tableName); MTable table = MTable.get(Env.getCtx(), m_tableName);
MColumn col = table.getColumn(columnName); MColumn col = table.getColumn(columnName);
referenceType = col.getAD_Reference_ID(); referenceType = col.getAD_Reference_ID();
GridField field = getTargetMField(columnName);
isEncrypted = (col.isEncrypted() || field.isEncrypted());
} }
if (DisplayType.isLookup(referenceType) if (isEncrypted)
{
addOperators(MQuery.OPERATORS_ENCRYPTED, listOperator);
}
else if (DisplayType.isLookup(referenceType)
|| DisplayType.YesNo == referenceType || DisplayType.YesNo == referenceType
|| DisplayType.Button == referenceType) || DisplayType.Button == referenceType)
{ {