Skip to content
Snippets Groups Projects
Commit 1860406d authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

fix filtered Attributes - load nothing if empty array or only invalid ids

parent c4b7b369
No related branches found
No related tags found
No related merge requests found
......@@ -76,15 +76,18 @@ else if (showEmpty || objectRowId)
attributeCond.andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", possibleAttributes);
}
if (vars.exists("$param.FilteredAttributeIds_param") && vars.getString("$param.FilteredAttributeIds_param"))
if (vars.getString("$param.FilteredAttributeIds_param"))
{
let filteredIds = JSON.parse(vars.getString("$param.FilteredAttributeIds_param"));
let filteredCondition = new SqlCondition();
let filteredIdChildren = AttributeUtil.getAllChildren(filteredIds);
filteredCondition.andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", filteredIdChildren);
filteredCondition.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?")
if (filteredIdChildren.length > 0)
{
filteredCondition.andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", filteredIdChildren)
.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?");
}
// return nothing if filteredAttributeIds is an empty array. (--> and 1=2)
attributeCond.andSqlCondition(filteredCondition, "1=2");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment