From cafe5bf2c12f6eafe54afe767d720e9c94ce7a1d Mon Sep 17 00:00:00 2001
From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local>
Date: Mon, 16 Dec 2019 11:28:15 +0100
Subject: [PATCH] Bugfixes in ObjectRelation and Order

---
 .../ObjectRelationType_entity.aod             |  1 -
 .../entityfields/uid/valueProcess.js          |  7 -------
 .../recordcontainers/jdito/onInsert.js        | 21 ++++++++++---------
 .../recordcontainers/db/conditionProcess.js   |  2 +-
 .../WorkflowInstancePreview_view.aod          |  4 ----
 5 files changed, 12 insertions(+), 23 deletions(-)
 delete mode 100644 entity/ObjectRelationType_entity/entityfields/uid/valueProcess.js

diff --git a/entity/ObjectRelationType_entity/ObjectRelationType_entity.aod b/entity/ObjectRelationType_entity/ObjectRelationType_entity.aod
index b482ea116c..86bd4e1e2e 100644
--- a/entity/ObjectRelationType_entity/ObjectRelationType_entity.aod
+++ b/entity/ObjectRelationType_entity/ObjectRelationType_entity.aod
@@ -16,7 +16,6 @@
     </entityProvider>
     <entityField>
       <name>UID</name>
-      <valueProcess>%aditoprj%/entity/ObjectRelationType_entity/entityfields/uid/valueProcess.js</valueProcess>
     </entityField>
     <entityField>
       <name>SOURCE_RELATION_TITLE</name>
diff --git a/entity/ObjectRelationType_entity/entityfields/uid/valueProcess.js b/entity/ObjectRelationType_entity/entityfields/uid/valueProcess.js
deleted file mode 100644
index 86ef789e06..0000000000
--- a/entity/ObjectRelationType_entity/entityfields/uid/valueProcess.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import("system.util");
-import("system.vars");
-import("system.result");
-import("system.neon");
-
-if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
-    result.string(util.getNewUUID());
\ No newline at end of file
diff --git a/entity/ObjectRelationType_entity/recordcontainers/jdito/onInsert.js b/entity/ObjectRelationType_entity/recordcontainers/jdito/onInsert.js
index fa718b256d..0a43729a32 100644
--- a/entity/ObjectRelationType_entity/recordcontainers/jdito/onInsert.js
+++ b/entity/ObjectRelationType_entity/recordcontainers/jdito/onInsert.js
@@ -5,6 +5,7 @@ import("system.vars");
 import("system.db");
 import("system.util");
 
+var rowData = vars.get("$local.rowdata");
 var newRelationType = util.getNewUUID();
 
 db.insertData("AB_OBJECTRELATIONTYPE", [
@@ -16,17 +17,17 @@ db.insertData("AB_OBJECTRELATIONTYPE", [
     "HIERARCHY",
     "ICON"
 ], null, [
-    util.getNewUUID(),
-    vars.get("$field.SOURCE_OBJECT_TYPE"),
-    vars.get("$field.SOURCE_RELATION_TITLE"),
+    rowData["UID.value"],
+    rowData["SOURCE_OBJECT_TYPE.value"],
+    rowData["SOURCE_RELATION_TITLE.value"],
     newRelationType,
     1,
-    vars.get("$field.HIERARCHY"),
-    vars.get("$field.ICON") // Icon is only savid in type1
+    rowData["HIERARCHY.value"],
+    rowData["ICON.value"] // Icon is only savid in type1
 ]);
 
-if (vars.getString("$field.Type2Enabled_proxy") == "1" 
-    && vars.get("$field.SOURCE_RELATION_TITLE") != vars.get("$field.DEST_RELATION_TITLE"))
+if (rowData["Type2Enabled_proxy.value"] == "1" 
+    && rowData["SOURCE_RELATION_TITLE.value"] != rowData["DEST_RELATION_TITLE.value"])
 {
     db.insertData("AB_OBJECTRELATIONTYPE", [
         "AB_OBJECTRELATIONTYPEID",
@@ -37,11 +38,11 @@ if (vars.getString("$field.Type2Enabled_proxy") == "1"
         "HIERARCHY"
     ], null, [
         util.getNewUUID(),
-        vars.get("$field.DEST_OBJECT_TYPE"),
-        vars.get("$field.DEST_RELATION_TITLE"),
+        rowData["DEST_OBJECT_TYPE.value"],
+        rowData["DEST_RELATION_TITLE.value"],
         newRelationType,
         2,
-        vars.get("$field.HIERARCHY")
+        rowData["HIERARCHY.value"]
     ]);
 }
 
diff --git a/entity/Order_entity/recordcontainers/db/conditionProcess.js b/entity/Order_entity/recordcontainers/db/conditionProcess.js
index 8cf25e0b60..d799cf1238 100644
--- a/entity/Order_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/Order_entity/recordcontainers/db/conditionProcess.js
@@ -9,7 +9,7 @@ if(vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param"))
     cond.andIfSet("SALESORDER.CONTACT_ID", "$param.ContactId_param");
 else {
     cond.andIfSet("SALESORDER.OBJECT_ROWID", "$param.ObjectRowId_param")
-        .andIfSet("SALESORDEER.OBJECT_TYPE", "$param.ObjectType_param");
+        .andIfSet("SALESORDER.OBJECT_TYPE", "$param.ObjectType_param");
 }
 //TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026
 result.string(cond.toString());
\ No newline at end of file
diff --git a/neonView/WorkflowInstancePreview_view/WorkflowInstancePreview_view.aod b/neonView/WorkflowInstancePreview_view/WorkflowInstancePreview_view.aod
index a7b70d875b..be12d2db26 100644
--- a/neonView/WorkflowInstancePreview_view/WorkflowInstancePreview_view.aod
+++ b/neonView/WorkflowInstancePreview_view/WorkflowInstancePreview_view.aod
@@ -37,10 +37,6 @@
           <name>5a2ac432-6901-485b-ad84-8fbefa04217b</name>
           <entityField>PROCESSDEFINITION_VERSION</entityField>
         </entityFieldLink>
-        <entityFieldLink>
-          <name>7eaa1915-e378-4e7f-9df8-28bbc43930d2</name>
-          <entityField>PROCESSVARIABLES</entityField>
-        </entityFieldLink>
       </fields>
     </genericViewTemplate>
   </children>
-- 
GitLab