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);
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

View File

@ -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

View File

@ -1785,7 +1785,7 @@ public class FindWindow extends Window implements EventListener<Event>, 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("%");
//