From 6e91b67a1bc70621d871bed1c1b67ff9ecf07995 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 24 May 2018 17:34:47 +0200 Subject: [PATCH] =?UTF-8?q?IDEMPIERE-3593=20Cannot=20search=20special=20ch?= =?UTF-8?q?aracters=20like=20=C3=9F=20in=20Name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/org/compiere/model/MQuery.java | 9 +++-- .../org/adempiere/webui/info/InfoWindow.java | 34 +++++++++++-------- .../adempiere/webui/window/FindWindow.java | 2 +- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MQuery.java b/org.adempiere.base/src/org/compiere/model/MQuery.java index 942a464406..6547eb66df 100644 --- a/org.adempiere.base/src/org/compiere/model/MQuery.java +++ b/org.adempiere.base/src/org/compiere/model/MQuery.java @@ -1156,8 +1156,13 @@ class Restriction implements Serializable sb.append(Operator); if ( ! (Operator.equals(MQuery.NULL) || Operator.equals(MQuery.NOT_NULL))) { - if (Code instanceof String) - sb.append(DB.TO_STRING(Code.toString())); + if (Code instanceof String) { + if (ColumnName.toUpperCase().startsWith("UPPER(")) { + sb.append("UPPER("+DB.TO_STRING(Code.toString())+")"); + } else { + sb.append(DB.TO_STRING(Code.toString())); + } + } else if (Code instanceof Timestamp) sb.append(DB.TO_DATE((Timestamp)Code, false)); else diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index 2458d0e090..ba93dd4d12 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -860,8 +860,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL } builder.append(columnClause) .append(" ") - .append(mInfoColumn.getQueryOperator()) - .append(" ?"); + .append(mInfoColumn.getQueryOperator()); + if (columnClause.toUpperCase().startsWith("UPPER(")) { + builder.append(" UPPER(?)"); + } else { + builder.append(" ?"); + } } } if (count > 0 && !checkAND.isChecked()) { @@ -979,20 +983,20 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL * @throws SQLException */ protected void setParameter (PreparedStatement pstmt, int parameterIndex, Object value, String queryOperator) throws SQLException{ - if (value instanceof Boolean) { - pstmt.setString(parameterIndex, ((Boolean) value).booleanValue() ? "Y" : "N"); - } else if (value instanceof String) { + if (value instanceof Boolean) { + pstmt.setString(parameterIndex, ((Boolean) value).booleanValue() ? "Y" : "N"); + } else if (value instanceof String) { if (queryOperator.equals(X_AD_InfoColumn.QUERYOPERATOR_Like)) { - StringBuilder valueStr = new StringBuilder(value.toString().toUpperCase()); - if (!valueStr.toString().endsWith("%")) - valueStr.append("%"); - pstmt.setString(parameterIndex, valueStr.toString()); - } else { - pstmt.setString(parameterIndex, (String)value); - } - } else { - pstmt.setObject(parameterIndex, value); - } + StringBuilder valueStr = new StringBuilder(value.toString()); + if (!valueStr.toString().endsWith("%")) + valueStr.append("%"); + pstmt.setString(parameterIndex, valueStr.toString()); + } else { + pstmt.setString(parameterIndex, (String)value); + } + } else { + pstmt.setObject(parameterIndex, value); + } } @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 8c90596612..6fb8ca3fc3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -1785,7 +1785,7 @@ public class FindWindow extends Window implements EventListener, ValueCha // Be more permissive for String columns if (isSearchLike(field)) { - StringBuilder valueStr = new StringBuilder(value.toString().toUpperCase()); + StringBuilder valueStr = new StringBuilder(value.toString()); if (!valueStr.toString().endsWith("%")) valueStr.append("%"); //