From 1860406dc17141549f6db90ec62669b6f5cd1754 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Thu, 24 Oct 2019 13:21:33 +0200 Subject: [PATCH] fix filtered Attributes - load nothing if empty array or only invalid ids --- .../recordcontainers/jdito/contentProcess.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/entity/AttributeRelation_entity/recordcontainers/jdito/contentProcess.js b/entity/AttributeRelation_entity/recordcontainers/jdito/contentProcess.js index ced0fcc55c..0300adac47 100644 --- a/entity/AttributeRelation_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/AttributeRelation_entity/recordcontainers/jdito/contentProcess.js @@ -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"); -- GitLab