IDEMPIERE-3593 Cannot search special characters like ß in Name

This commit is contained in:
Carlos Ruiz 2018-05-24 17:34:47 +02:00
parent 6b89176b2f
commit 6e91b67a1b
3 changed files with 27 additions and 18 deletions

View File

@ -1156,8 +1156,13 @@ class Restriction implements Serializable
sb.append(Operator); sb.append(Operator);
if ( ! (Operator.equals(MQuery.NULL) || Operator.equals(MQuery.NOT_NULL))) if ( ! (Operator.equals(MQuery.NULL) || Operator.equals(MQuery.NOT_NULL)))
{ {
if (Code instanceof String) if (Code instanceof String) {
sb.append(DB.TO_STRING(Code.toString())); 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) else if (Code instanceof Timestamp)
sb.append(DB.TO_DATE((Timestamp)Code, false)); sb.append(DB.TO_DATE((Timestamp)Code, false));
else else

View File

@ -860,8 +860,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
builder.append(columnClause) builder.append(columnClause)
.append(" ") .append(" ")
.append(mInfoColumn.getQueryOperator()) .append(mInfoColumn.getQueryOperator());
.append(" ?"); if (columnClause.toUpperCase().startsWith("UPPER(")) {
builder.append(" UPPER(?)");
} else {
builder.append(" ?");
}
} }
} }
if (count > 0 && !checkAND.isChecked()) { if (count > 0 && !checkAND.isChecked()) {
@ -979,20 +983,20 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* @throws SQLException * @throws SQLException
*/ */
protected void setParameter (PreparedStatement pstmt, int parameterIndex, Object value, String queryOperator) throws SQLException{ protected void setParameter (PreparedStatement pstmt, int parameterIndex, Object value, String queryOperator) throws SQLException{
if (value instanceof Boolean) { if (value instanceof Boolean) {
pstmt.setString(parameterIndex, ((Boolean) value).booleanValue() ? "Y" : "N"); pstmt.setString(parameterIndex, ((Boolean) value).booleanValue() ? "Y" : "N");
} else if (value instanceof String) { } else if (value instanceof String) {
if (queryOperator.equals(X_AD_InfoColumn.QUERYOPERATOR_Like)) { if (queryOperator.equals(X_AD_InfoColumn.QUERYOPERATOR_Like)) {
StringBuilder valueStr = new StringBuilder(value.toString().toUpperCase()); StringBuilder valueStr = new StringBuilder(value.toString());
if (!valueStr.toString().endsWith("%")) if (!valueStr.toString().endsWith("%"))
valueStr.append("%"); valueStr.append("%");
pstmt.setString(parameterIndex, valueStr.toString()); pstmt.setString(parameterIndex, valueStr.toString());
} else { } else {
pstmt.setString(parameterIndex, (String)value); pstmt.setString(parameterIndex, (String)value);
} }
} else { } else {
pstmt.setObject(parameterIndex, value); pstmt.setObject(parameterIndex, value);
} }
} }
@Override @Override

View File

@ -1785,7 +1785,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
// Be more permissive for String columns // Be more permissive for String columns
if (isSearchLike(field)) if (isSearchLike(field))
{ {
StringBuilder valueStr = new StringBuilder(value.toString().toUpperCase()); StringBuilder valueStr = new StringBuilder(value.toString());
if (!valueStr.toString().endsWith("%")) if (!valueStr.toString().endsWith("%"))
valueStr.append("%"); valueStr.append("%");
// //