IDEMPIERE-4999 Advanced Lookup on sub-tab of a window triggers a PSQL Exception (#939)

- Integrate patch from Tony Snook to fix issue with "product category"
and "Chosen Multiple Selection List" field
This commit is contained in:
hengsin 2021-10-22 18:23:39 +08:00 committed by GitHub
parent eb82c679ca
commit a73ce05875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 4 deletions

View File

@ -55,7 +55,7 @@ public class MQuery implements Serializable, Cloneable
/** /**
* *
*/ */
private static final long serialVersionUID = 4726305684993324747L; private static final long serialVersionUID = -8671209250739719461L;
/** /**
* Get Query from Parameter * Get Query from Parameter
@ -805,6 +805,8 @@ public class MQuery implements Serializable, Cloneable
/** /**
* Add Restriction * Add Restriction
* @param whereClause SQL WHERE clause * @param whereClause SQL WHERE clause
* @param andCondition
* @param joinDepth
*/ */
public void addRestriction (String whereClause, boolean andCondition, int joinDepth) public void addRestriction (String whereClause, boolean andCondition, int joinDepth)
{ {
@ -814,6 +816,22 @@ public class MQuery implements Serializable, Cloneable
m_list.add(r); m_list.add(r);
m_newRecord = whereClause.equals(NEWRECORD); m_newRecord = whereClause.equals(NEWRECORD);
} // addRestriction } // addRestriction
/**
* Add Restriction
* @param whereClause SQL WHERE clause
* @param joinDepth
* @param andOrCondition
*/
public void addRestriction (String whereClause, int joinDepth, String andOrCondition)
{
if (whereClause == null || whereClause.trim().length() == 0)
return;
Restriction r = new Restriction (whereClause, andOrCondition, joinDepth);
m_list.add(r);
m_newRecord = whereClause.equals(NEWRECORD);
} // addRestriction
/** /**
* Add Restriction * Add Restriction
* @param whereClause SQL WHERE clause * @param whereClause SQL WHERE clause

View File

@ -1926,16 +1926,16 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
if (!(parsedValue instanceof Integer)) { if (!(parsedValue instanceof Integer)) {
continue; continue;
} }
m_query.addRestriction(getSubCategoryWhereClause(field, ((Integer) parsedValue).intValue()), andOr, openBrackets); m_query.addRestriction(getSubCategoryWhereClause(field, ((Integer) parsedValue).intValue()), openBrackets, andOr);
} }
else if ((field.getDisplayType()==DisplayType.ChosenMultipleSelectionList||field.getDisplayType()==DisplayType.ChosenMultipleSelectionSearch||field.getDisplayType()==DisplayType.ChosenMultipleSelectionTable) && else if ((field.getDisplayType()==DisplayType.ChosenMultipleSelectionList||field.getDisplayType()==DisplayType.ChosenMultipleSelectionSearch||field.getDisplayType()==DisplayType.ChosenMultipleSelectionTable) &&
(MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator) || MQuery.OPERATORS[MQuery.NOT_EQUAL_INDEX].getValue().equals(Operator))) (MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator) || MQuery.OPERATORS[MQuery.NOT_EQUAL_INDEX].getValue().equals(Operator)))
{ {
String clause = DB.intersectClauseForCSV(ColumnSQL, parsedValue.toString()); String clause = DB.intersectClauseForCSV(ColumnSQL, parsedValue.toString());
if (MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator)) if (MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator))
m_query.addRestriction(clause, andOr, openBrackets); m_query.addRestriction(clause, openBrackets, andOr);
else else
m_query.addRestriction("NOT (" + clause + ")", andOr, openBrackets); m_query.addRestriction("NOT (" + clause + ")", openBrackets, andOr);
} }
else else
m_query.addRestriction(ColumnSQL, Operator, parsedValue, m_query.addRestriction(ColumnSQL, Operator, parsedValue,