From 6aa606c25e4ab0bfd27a2cc512b9141f4e099546 Mon Sep 17 00:00:00 2001
From: Sophia Leierseder <s.leierseder@adito.de>
Date: Thu, 25 Apr 2019 08:29:14 +0200
Subject: [PATCH] Fixes Parameter

---
 .../DocumentTemplateLink_entity.aod           |  6 ++++++
 .../valueProcess.js                           |  3 +--
 .../documenttemplate_id_child/stateProcess.js |  4 ++--
 .../documenttemplate_id_child/valueProcess.js |  8 ++++----
 .../DocumentTemplate_entity.aod               | 20 ++++++-------------
 entity/Offer_entity/Offer_entity.aod          |  8 ++++----
 .../valueProcess.js                           |  2 +-
 7 files changed, 24 insertions(+), 27 deletions(-)
 rename entity/{DocumentTemplate_entity => DocumentTemplateLink_entity}/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js (95%)

diff --git a/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod b/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod
index 1946ab3340..21fbf86b1a 100644
--- a/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod
+++ b/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod
@@ -56,6 +56,12 @@
         <entityName>DocumentTemplate_entity</entityName>
         <fieldName>Attachments</fieldName>
       </dependency>
+      <children>
+        <entityParameter>
+          <name>DocumentTemplateType_param</name>
+          <valueProcess>%aditoprj%/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
     </entityConsumer>
     <entityProvider>
       <name>Links</name>
diff --git a/entity/DocumentTemplate_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js b/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js
similarity index 95%
rename from entity/DocumentTemplate_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js
rename to entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js
index 0987589736..68704076d0 100644
--- a/entity/DocumentTemplate_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js
+++ b/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js
@@ -1,6 +1,5 @@
-import("system.result");
 import("system.vars");
-
+import("system.result");
 if(vars.getString("$field.TYPE") == "ATT"){
     result.string("$field.DOCUMENTTEMPLATEID");
 }
\ No newline at end of file
diff --git a/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js b/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js
index d06fed7cef..1e6f365bf2 100644
--- a/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js
+++ b/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js
@@ -4,8 +4,8 @@ import("system.result");
 import("system.vars");
 import("system.db");
 
-var parenttype = db.cell("select TYPE from DOCUMENTTEMPLATE");
-
+//var parenttype = db.cell("select TYPE from DOCUMENTTEMPLATE");
+//
 //
 //if(parenttype == "MAI")
 //    result.string("DISABLED");
\ No newline at end of file
diff --git a/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/valueProcess.js b/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/valueProcess.js
index 75ec01b1f8..ce2998f625 100644
--- a/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/valueProcess.js
+++ b/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/valueProcess.js
@@ -2,7 +2,7 @@ import("system.logging");
 import("system.result");
 import("system.vars");
 
-//if (vars.exists("$param.DocumentTemplateType_param")) 
-//{
-//    result.string(vars.get("$param.DocumentTemplateType_param"));
-//}
+if (vars.exists("$param.DocumentTemplateType_param")) 
+{
+    result.string(vars.get("$param.DocumentTemplateType_param"));
+}
diff --git a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod
index 2b08a4cfca..87e643c5d7 100644
--- a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod
+++ b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod
@@ -181,13 +181,6 @@
         </entityParameter>
       </children>
     </entityConsumer>
-    <entityParameter>
-      <name>DocumentTemplateType_param</name>
-      <expose v="true" />
-      <triggerRecalculation v="true" />
-      <mandatory v="false" />
-      <description>PARAMETER</description>
-    </entityParameter>
     <entityProvider>
       <name>Attachments</name>
       <fieldType>DEPENDENCY_IN</fieldType>
@@ -201,13 +194,6 @@
           <isConsumer v="false" />
         </entityDependency>
       </dependencies>
-      <children>
-        <entityParameter>
-          <name>DocumentTemplateType_param</name>
-          <valueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js</valueProcess>
-          <mandatory v="false" />
-        </entityParameter>
-      </children>
     </entityProvider>
     <entityConsumer>
       <name>Links</name>
@@ -242,6 +228,12 @@
         </entityDependency>
       </dependencies>
     </entityProvider>
+    <entityParameter>
+      <name>DocumentTemplateType_param</name>
+      <expose v="true" />
+      <triggerRecalculation v="true" />
+      <description>PARAMETER</description>
+    </entityParameter>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod
index 29aee8674e..29df95ceac 100644
--- a/entity/Offer_entity/Offer_entity.aod
+++ b/entity/Offer_entity/Offer_entity.aod
@@ -728,14 +728,14 @@
         <fieldName>DocumentTemplateProvider</fieldName>
       </dependency>
       <children>
-        <entityParameter>
-          <name>DocumentTemplateType_param</name>
-          <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/documenttemplatetext/children/documenttemplatetype_param/valueProcess.js</valueProcess>
-        </entityParameter>
         <entityParameter>
           <name>DocumentTemplateTypeClassification_param</name>
           <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/documenttemplatetext/children/documenttemplatetypeclassification_param/valueProcess.js</valueProcess>
         </entityParameter>
+        <entityParameter>
+          <name>DocumentTemplateType_param</name>
+          <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/documenttemplatetext/children/documenttemplatetype_param/valueProcess.js</valueProcess>
+        </entityParameter>
       </children>
     </entityConsumer>
     <entityField>
diff --git a/entity/Offer_entity/entityfields/documenttemplatetext/children/documenttemplatetype_param/valueProcess.js b/entity/Offer_entity/entityfields/documenttemplatetext/children/documenttemplatetype_param/valueProcess.js
index 90d0786d0d..361c9a2190 100644
--- a/entity/Offer_entity/entityfields/documenttemplatetext/children/documenttemplatetype_param/valueProcess.js
+++ b/entity/Offer_entity/entityfields/documenttemplatetext/children/documenttemplatetype_param/valueProcess.js
@@ -1,2 +1,2 @@
-import("system.result");
+import("system.result");
 result.string("TEX");
\ No newline at end of file
-- 
GitLab