From cd4ac46ca2fcfaa928ee658054db8614a278e210 Mon Sep 17 00:00:00 2001
From: Sascha Schmidt <s.schmidt@adito.de>
Date: Wed, 27 Oct 2021 11:28:09 +0200
Subject: [PATCH] Fixes from MR/CR

---
 entity/WorkflowTask_entity/afterSave.js         | 3 +++
 process/EwsSyncContact_lib/process.js           | 2 +-
 process/FilterViewAction_lib/process.js         | 4 ++--
 process/ImporterMappingFunctions_lib/process.js | 8 ++++----
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/entity/WorkflowTask_entity/afterSave.js b/entity/WorkflowTask_entity/afterSave.js
index 8a96fed45a..1181e2a762 100644
--- a/entity/WorkflowTask_entity/afterSave.js
+++ b/entity/WorkflowTask_entity/afterSave.js
@@ -1,3 +1,4 @@
+import("system.neonFilter");
 import("system.neon");
 import("system.workflow");
 import("system.vars");
@@ -26,7 +27,9 @@ if (entityData["FORMRESULT"])
     }, startVal);
 
     if (newestTask.id !== null)
+    {
         neon.openContextWithRecipe("WorkflowTask", "WorkflowTaskPreview_view", neonFilter.createEntityRecordsRecipeBuilder().uidsIncludelist([newestTask.id]).toString(), neon.OPERATINGSTATE_VIEW);
+    }
     else
     {
         var params = {
diff --git a/process/EwsSyncContact_lib/process.js b/process/EwsSyncContact_lib/process.js
index 123a053a22..2bd6c50a85 100644
--- a/process/EwsSyncContact_lib/process.js
+++ b/process/EwsSyncContact_lib/process.js
@@ -687,7 +687,7 @@ EwsClientSyncUtils.updateEntrysInSyncTable = function(pUserMapping, pUserLoginPr
                     var search = JSON.parse(pPropvalClob)["search"]; // search part of the filter JSON
                     var whereCond = db.toFilterCondition(JSON.stringify(search), type);
                     //--------------------------------------------------------------------------
-                    if(whereCond)//global variables cannot be read here and must be passed per user
+                    if(Utils.isNullOrEmptyString(whereCond)) //global variables cannot be read here and must be passed per user
                     {
                         whereCond = StringUtils.replaceAll(whereCond, "$$$global.user.contactId$$$", tempUserMapping[2]);
                     }
diff --git a/process/FilterViewAction_lib/process.js b/process/FilterViewAction_lib/process.js
index 7bfa3759b7..e5596b6cbf 100644
--- a/process/FilterViewAction_lib/process.js
+++ b/process/FilterViewAction_lib/process.js
@@ -72,12 +72,12 @@ FilterViewActionUtils.getUidsByEntityFilter = function (pContext, pFilter, pPara
         .entity(ContextUtils.getEntity(pContext))
         .fields(["#UID"]);
         
-        if (pFilter.filter)
+        if (Utils.isNullOrEmpty(pFilter.filter))
         {
             loadRowsConfig.filter(JSON.stringify(pFilter.filter));
         }
     
-        if(pParameters)
+        if(Utils.isNullOrEmpty(pParameters))
         {
             Object.keys(pParameters).forEach(function(key){
                 loadRowsConfig.addParameter(key, pParameters[key])
diff --git a/process/ImporterMappingFunctions_lib/process.js b/process/ImporterMappingFunctions_lib/process.js
index 0d00cb8f1b..ac22fd4551 100644
--- a/process/ImporterMappingFunctions_lib/process.js
+++ b/process/ImporterMappingFunctions_lib/process.js
@@ -526,15 +526,15 @@ function iComm (pObject)
         standard = "1";
     }
     
+    //@deprecated It should be used ObjectRowid and ObjectType
+    objectRowId = objectRowId || contactId;
+    objectType = objectType || "Contact";
+    
     if (!address || !medium || !objectRowId) 
     {
         return true;
     }
     
-    //@deprecated It should be used ObjectRowid and ObjectType
-    objectRowId = objectRowId || contactId;
-    objectType = objectType || "Contact";
-    
     const COMMUNICATION = this.getTableCase("communication");
     const COMMUNICATIONID = this.getColumnCase("communicationid");
     const OBJECT_ROWID = this.getColumnCase("object_rowid");
-- 
GitLab