IDEMPIERE-3309 Info Window C_Bpartner_Location.C_Location_ID sIdentifier='Y' break sorting

This commit is contained in:
Carlos Ruiz 2017-03-26 12:54:27 +02:00
parent b8b7da7193
commit 9e3160a121
1 changed files with 9 additions and 20 deletions

View File

@ -2136,36 +2136,25 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
{
String tmp = colsql.substring(0, lastSpaceIdx).trim();
char last = tmp.charAt(tmp.length() - 1);
if (tmp.toLowerCase().endsWith("as"))
String alias = colsql.substring(lastSpaceIdx).trim();
boolean hasAlias = alias.matches("^[a-zA-Z_][a-zA-Z0-9_]*$"); // valid SQL alias - starts with letter then digits, letters, underscore
if (tmp.toLowerCase().endsWith("as") && hasAlias)
{
colsql = colsql.substring(lastSpaceIdx).trim();
colsql = alias;
}
else if (!(last == '*' || last == '-' || last == '+' || last == '/' || last == '>' || last == '<' || last == '='))
{
tmp = colsql.substring(lastSpaceIdx).trim();
if (tmp.startsWith("\"") && tmp.endsWith("\""))
if (alias.startsWith("\"") && alias.endsWith("\""))
{
colsql = colsql.substring(lastSpaceIdx).trim();
colsql = alias;
}
else
{
boolean hasAlias = true;
for(int i = 0; i < tmp.length(); i++)
{
char c = tmp.charAt(i);
if (Character.isLetterOrDigit(c))
{
continue;
}
else
{
hasAlias = false;
break;
}
}
if (hasAlias)
{
colsql = colsql.substring(lastSpaceIdx).trim();
colsql = alias;
}
}
}