details:   https://code.openbravo.com/erp/devel/pi/rev/66d1115c23d4
changeset: 27293:66d1115c23d4
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Aug 12 15:05:49 2015 +0200
summary:   Fixes issue 30561: UPPER is used inCustomQuerySelectorDatasource to 
build query

When the CustomQuerySelectorDatasource built the query to achieve case 
insensitive filtering, it used to use the LOWER function. We decided to change 
this, as UPPER is used much more often throughout the codebase. The fix has 
been checked with custom query selectors using both the iContains and the 
iStartsWith operators

diffstat:

 
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java
 |  14 +++++-----
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (36 lines):

diff -r 3b3aefef0ce7 -r 66d1115c23d4 
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java
--- 
a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java
  Mon Aug 10 15:03:57 2015 +0200
+++ 
b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java
  Wed Aug 12 15:05:49 2015 +0200
@@ -289,7 +289,7 @@
    * <li>Boolean Domain Type: Returns an equals clause <i>field.clauseLeftPart 
= value</i></li>
    * <li>Foreign Key Domain Type: Returns an equals clause 
<i>field.clauseLeftPart.id = value</i></li>
    * <li>Unique Id Domain Type: Returns an equals clause 
<i>field.clauseLeftPart = value</i></li>
-   * <li>String Domain Type: Compares the clause left part with the value 
using the lower database
+   * <li>String Domain Type: Compares the clause left part with the value 
using the upper database
    * function which to make comparison case insensitive.
    * </ul>
    * 
@@ -380,17 +380,17 @@
       }
     } else {
       if ("iStartsWith".equals(operator)) {
-        whereClause = "lower("
+        whereClause = "upper("
             + field.getClauseLeftPart()
-            + ") LIKE "
+            + ") LIKE upper("
             + getTypedParameterAlias(typedParameters, 
value.toLowerCase().replaceAll(" ", "%")
-                + "%");
+                + "%") + ")";
       } else {
-        whereClause = "lower("
+        whereClause = "upper("
             + field.getClauseLeftPart()
-            + ") LIKE "
+            + ") LIKE upper("
             + getTypedParameterAlias(typedParameters, "%"
-                + value.toLowerCase().replaceAll(" ", "%") + "%");
+                + value.toLowerCase().replaceAll(" ", "%") + "%") + ")";
       }
     }
     return whereClause;

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to