details:   https://code.openbravo.com/erp/devel/pi/rev/eb415e9bc94f
changeset: 22708:eb415e9bc94f
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Mar 13 19:04:19 2014 +0100
summary:   Fixes issue 25190: Error when searching for characters like ß, in 
grid view

This happened because when a text field was filtered ignoring the case, the 
left part of the expression was uppercased using a database method while the 
right part was uppercased using the String.toUpperCase() java method.

diffstat:

 
modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
 |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 0630b904462c -r eb415e9bc94f 
modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
--- 
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
       Thu Mar 13 18:44:57 2014 +0100
+++ 
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
       Thu Mar 13 19:04:19 2014 +0100
@@ -644,11 +644,10 @@
       }
     }
 
+    String alias = getTypedParameterAlias();
     if (ignoreCase(property, operator)) {
-      localValue = localValue.toString().toUpperCase();
+      alias = "upper(" + alias + ")";
     }
-
-    final String alias = getTypedParameterAlias();
     String clause;
     if (isLike(operator)) {
       clause = alias + " escape '" + ESCAPE_CHAR + "' ";
@@ -691,12 +690,12 @@
     if (isLike(operator)) {
       if (operator.equals(OPERATOR_INOTCONTAINS) || 
operator.equals(OPERATOR_ICONTAINS)
           || operator.equals(OPERATOR_CONTAINSFIELD)) {
-        return "%" + escapeLike(value.toString().toUpperCase()).replaceAll(" 
", "%") + "%";
+        return "%" + escapeLike(value.toString()).replaceAll(" ", "%") + "%";
       } else if (operator.equals(OPERATOR_NOTCONTAINS) || 
operator.equals(OPERATOR_CONTAINS)) {
         return "%" + escapeLike(value.toString()).replaceAll(" ", "%") + "%";
       } else if (operator.equals(OPERATOR_INOTSTARTSWITH) || 
operator.equals(OPERATOR_ISTARTSWITH)
           || operator.equals(OPERATOR_STARTSWITHFIELD)) {
-        return escapeLike(value.toString().toUpperCase()).replaceAll(" ", "%") 
+ "%";
+        return escapeLike(value.toString()).replaceAll(" ", "%") + "%";
       } else if (operator.equals(OPERATOR_NOTSTARTSWITH) || 
operator.equals(OPERATOR_STARTSWITH)) {
         return escapeLike(value.toString()).replaceAll(" ", "%") + "%";
       } else {

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to