IDEMPIERE-1539 search without "%" mark in value, name, description fields

This commit is contained in:
Carlos Ruiz 2018-07-19 23:09:04 +02:00
parent fce33028c3
commit ba541e7dc0
4 changed files with 29 additions and 5 deletions

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Dec 23, 2013 1:36:38 PM COT
-- IDEMPIERE-1539
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,Created,CreatedBy,Updated,UpdatedBy,IsActive,EntityType,AD_Client_ID,AD_Org_ID) VALUES (200168,200061,'9562f4db-97a9-4df5-99d0-b2f5bc0e2b4c','Full Like','LIKE',TO_DATE('2013-12-23 13:36:48','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-12-23 13:36:48','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,0)
;
SELECT register_migration_script('201312231347_IDEMPIERE-1539.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- Dec 23, 2013 1:36:38 PM COT
-- IDEMPIERE-1539
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,Created,CreatedBy,Updated,UpdatedBy,IsActive,EntityType,AD_Client_ID,AD_Org_ID) VALUES (200168,200061,'9562f4db-97a9-4df5-99d0-b2f5bc0e2b4c','Full Like','LIKE',TO_TIMESTAMP('2013-12-23 13:36:48','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-12-23 13:36:48','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,0)
;
SELECT register_migration_script('201312231347_IDEMPIERE-1539.sql') FROM dual
;

View File

@ -30,7 +30,7 @@ public class X_AD_InfoColumn extends PO implements I_AD_InfoColumn, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20171031L;
private static final long serialVersionUID = 20180719L;
/** Standard Constructor */
public X_AD_InfoColumn (Properties ctx, int AD_InfoColumn_ID, String trxName)
@ -572,6 +572,8 @@ public class X_AD_InfoColumn extends PO implements I_AD_InfoColumn, I_Persistent
public static final String QUERYOPERATOR_LeEq = "<=";
/** != = != */
public static final String QUERYOPERATOR_NotEq = "!=";
/** Full Like = LIKE */
public static final String QUERYOPERATOR_FullLike = "LIKE";
/** Set Query Operator.
@param QueryOperator
Operator for database query

View File

@ -987,14 +987,17 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (value instanceof Boolean) {
pstmt.setString(parameterIndex, ((Boolean) value).booleanValue() ? "Y" : "N");
} else if (value instanceof String) {
StringBuilder valueStr = new StringBuilder(value.toString());
if (queryOperator.equals(X_AD_InfoColumn.QUERYOPERATOR_Like)) {
StringBuilder valueStr = new StringBuilder(value.toString());
if (!valueStr.toString().endsWith("%"))
valueStr.append("%");
pstmt.setString(parameterIndex, valueStr.toString());
} else {
pstmt.setString(parameterIndex, (String)value);
} else if (queryOperator.equals(X_AD_InfoColumn.QUERYOPERATOR_FullLike)) {
if (!valueStr.toString().startsWith("%"))
valueStr.insert(0, "%");
if (!valueStr.toString().endsWith("%"))
valueStr.append("%");
}
pstmt.setString(parameterIndex, valueStr.toString());
} else {
pstmt.setObject(parameterIndex, value);
}