From 4d98e2cc4d99742d33483793ea871e3160bc4344 Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Mon, 13 May 2019 13:29:44 +0200
Subject: [PATCH] 360Grad fixes

---
 .../newcampaignparticipant/stateProcess.js    | 24 ++++++++++++-------
 .../children/newcontract/stateProcess.js      | 23 +++++++++++-------
 .../children/newoffer/stateProcess.js         | 23 +++++++++++-------
 .../children/newsalesproject/stateProcess.js  | 24 ++++++++++++-------
 .../recordcontainers/jdito/contentProcess.js  |  3 ++-
 .../ClassificationAdmin.aod                   |  1 +
 process/Context_lib/process.js                |  8 +++----
 7 files changed, 69 insertions(+), 37 deletions(-)

diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/stateProcess.js
index da6fd5283ab..353aa9f3676 100644
--- a/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/stateProcess.js
+++ b/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/stateProcess.js
@@ -3,13 +3,21 @@ import("system.neon");
 import("system.result");
 
 var contextList = JSON.parse(vars.getString("$param.ObjectType_param"));
-var found = false;
-contextList.forEach(function (context) 
+if (contextList)
 {
-    if(context == "Campaign")
-        found = true;        
-});
-if(found)
-    result.string(neon.COMPONENTSTATE_AUTO);
+    var found = false;
+
+    contextList.forEach(function (context) 
+    {
+        if(context == "Campaign")
+            found = true;        
+    });
+    if(found)
+        result.string(neon.COMPONENTSTATE_AUTO);
+    else
+        result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
 else
-    result.string(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
+{
+    result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
\ No newline at end of file
diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newcontract/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newcontract/stateProcess.js
index fc6fedaff88..f1cfb310581 100644
--- a/entity/360Degree_entity/entityfields/newmodule/children/newcontract/stateProcess.js
+++ b/entity/360Degree_entity/entityfields/newmodule/children/newcontract/stateProcess.js
@@ -3,13 +3,20 @@ import("system.vars");
 import("system.neon");
     
 var contextList = JSON.parse(vars.getString("$param.ObjectType_param"));
-var found = false;
-contextList.forEach(function (context) 
+if (contextList)
 {
-    if(context == "Contract")
-        found = true;        
-});
-if(found)
-    result.string(neon.COMPONENTSTATE_AUTO);
+    var found = false;
+    contextList.forEach(function (context) 
+    {
+        if(context == "Contract")
+            found = true;        
+    });
+    if(found)
+        result.string(neon.COMPONENTSTATE_AUTO);
+    else
+        result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
 else
-    result.string(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
+{
+    result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
\ No newline at end of file
diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newoffer/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newoffer/stateProcess.js
index 43eff244956..02a2b07b699 100644
--- a/entity/360Degree_entity/entityfields/newmodule/children/newoffer/stateProcess.js
+++ b/entity/360Degree_entity/entityfields/newmodule/children/newoffer/stateProcess.js
@@ -3,13 +3,20 @@ import("system.neon");
 import("system.result");
 
 var contextList = JSON.parse(vars.getString("$param.ObjectType_param"));
-var found = false;
-contextList.forEach(function (context) 
+if (contextList)
 {
-    if(context == "Offer")
-        found = true;        
-});
-if(found)
-    result.string(neon.COMPONENTSTATE_AUTO);
+    var found = false;
+    contextList.forEach(function (context) 
+    {
+        if(context == "Offer")
+            found = true;        
+    });
+    if(found)
+        result.string(neon.COMPONENTSTATE_AUTO);
+    else
+        result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
 else
-    result.string(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
+{
+    result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
\ No newline at end of file
diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/stateProcess.js
index faec2ba7945..f23023f7d17 100644
--- a/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/stateProcess.js
+++ b/entity/360Degree_entity/entityfields/newmodule/children/newsalesproject/stateProcess.js
@@ -3,13 +3,21 @@ import("system.neon");
 import("system.result");
 
 var contextList = JSON.parse(vars.getString("$param.ObjectType_param"));
-var found = false;
-contextList.forEach(function (context) 
+if (contextList)
 {
-    if(context == "Salesproject")
-        found = true;        
-});
-if(found)
-    result.string(neon.COMPONENTSTATE_AUTO);
+    var found = false;
+    
+    contextList.forEach(function (context) 
+    {
+        if(context == "Salesproject")
+            found = true;        
+    });
+    if(found)
+        result.string(neon.COMPONENTSTATE_AUTO);
+    else
+        result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
 else
-    result.string(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
+{
+    result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
diff --git a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
index 5f91637c836..545b0cad0f7 100644
--- a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
@@ -1,3 +1,4 @@
+import("system.logging");
 import("system.util");
 import("system.db");
 import("system.vars");
@@ -19,7 +20,7 @@ if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"
             filter.childs.forEach(function(child)
             {
                 if(child.name === "ACTIVE")
-                    active = JSON.parse(child.key);
+                    active = child.key;
             });  
         }  
     }
diff --git a/neonContext/ClassificationAdmin/ClassificationAdmin.aod b/neonContext/ClassificationAdmin/ClassificationAdmin.aod
index 39b6239be46..7c257e5c23a 100644
--- a/neonContext/ClassificationAdmin/ClassificationAdmin.aod
+++ b/neonContext/ClassificationAdmin/ClassificationAdmin.aod
@@ -2,6 +2,7 @@
 <neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0">
   <name>ClassificationAdmin</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <icon>VAADIN:ABACUS</icon>
   <mainview>ClassificationAdminMain_view</mainview>
   <filterview>ClassificationAdminFilter_view</filterview>
   <entity>ClassificationAdmin_entity</entity>
diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js
index f38b695d457..959bffccf44 100644
--- a/process/Context_lib/process.js
+++ b/process/Context_lib/process.js
@@ -451,9 +451,9 @@ ContextUtils.getContextDataSql = function(pContextId, pContactId, pWithDate, pAc
             activeStates.forEach(function (state) 
             {   
                 if(pActive)
-                    condSub.orPrepare(ownContextSelector.tableName + "." + ownContextSelector.stateField, state)
+                    condSub.orPrepare(ownContextSelector.getFullField(ownContextSelector.stateField), state)
                 else
-                    condSub.andPrepare(ownContextSelector.tableName + "." + ownContextSelector.stateField, state, "# != ?")
+                    condSub.andPrepare(ownContextSelector.getFullField(ownContextSelector.stateField), state, "# != ?")
             });
             cond.andSqlCondition(condSub);   
         }
@@ -473,10 +473,10 @@ ContextUtils.getContextDataSql = function(pContextId, pContactId, pWithDate, pAc
     
     var dateColumn = "";
     if (pWithDate === true)
-        dateColumn = ", " + (ownContextSelector.creationDateField || "''");
+        dateColumn = ", " + (ownContextSelector.getFullField(ownContextSelector.creationDateField) || "''");
     var stateColumn = "";
     if (pWithState === true)
-        stateColumn = ", " + (ownContextSelector.stateField || "''");
+        stateColumn = ", " + (ownContextSelector.getFullField(ownContextSelector.stateField) || "''");
     if (ownContextSelector.condition)
         cond.andSqlCondition(ownContextSelector.condition);
     var res = cond.buildSql("select " + ownContextSelector.getFullIdField() + ", " + ownContextSelector.titleExpression + dateColumn + stateColumn 
-- 
GitLab