From cf0ad3fb7a35556a3c3577716d0b62a86bf0bff2 Mon Sep 17 00:00:00 2001
From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local>
Date: Tue, 22 Oct 2019 13:42:04 +0200
Subject: [PATCH] Attribute filter fix for boolean

---
 process/AttributeFilter_lib/process.js | 10 ++++++++--
 process/Attribute_lib/process.js       |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/process/AttributeFilter_lib/process.js b/process/AttributeFilter_lib/process.js
index d4a51281da..2177479e97 100644
--- a/process/AttributeFilter_lib/process.js
+++ b/process/AttributeFilter_lib/process.js
@@ -107,7 +107,7 @@ AttributeFilterExtensionMaker.getFilterCondition = function(pObjectType, pFilter
     var attributeId = name.id;
     var attributeType = name.type;
     
-    if (attributeType == $AttributeTypes.VOID.toString())
+    if (attributeType == $AttributeTypes.VOID.toString() || (attributeType == $AttributeTypes.BOOLEAN.toString() && (pOperatorName == "IS NOT NULL" || pOperatorName == "IS NULL")))
     {
         preparedValues.push([pObjectType, SqlUtils.getSingleColumnType("AB_ATTRIBUTERELATION.OBJECT_TYPE")]);
         preparedValues.push([attributeId, SqlUtils.getSingleColumnType("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID")]);
@@ -128,7 +128,13 @@ AttributeFilterExtensionMaker.getFilterCondition = function(pObjectType, pFilter
         var dbField = AttributeTypeUtil.getDatabaseField(name.type);
 
         var condition = pCondition;
-        condition = condition.replace("{'table.column'}", dbField, "g");
+        if (attributeType == $AttributeTypes.BOOLEAN.toString())
+            condition = dbField + (pOperatorName == "LIKE" ? " = " : " != ")  + pRawValue;
+        else
+        {
+            condition = pCondition;
+            condition = condition.replace("{'table.column'}", dbField, "g");
+        }
         preparedValues.push([pObjectType, SqlUtils.getSingleColumnType("AB_ATTRIBUTERELATION.OBJECT_TYPE")]);
         preparedValues.push([attributeId, SqlUtils.getSingleColumnType("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID")]);
 
diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js
index 1dcfae598c..aaf8831ae1 100644
--- a/process/Attribute_lib/process.js
+++ b/process/Attribute_lib/process.js
@@ -1159,7 +1159,7 @@ AttributeUsageUtil.removeDuplicates = function (pAttributeId)
     
     var attributeSelect = newSelect("AB_ATTRIBUTEUSAGEID, AB_ATTRIBUTE_ID, OBJECT_TYPE")
                                 .from("AB_ATTRIBUTEUSAGE")
-                                .and(null, newSelect("AB_ATTRIBUTEUSAGEID")
+                                .where(null, newSelect("AB_ATTRIBUTEUSAGEID")
                                                 .from("AB_ATTRIBUTEUSAGE AU")
                                                 .where("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AU.AB_ATTRIBUTE_ID")
                                                 .and("AB_ATTRIBUTEUSAGE.OBJECT_TYPE = AU.OBJECT_TYPE")
-- 
GitLab