From 1777efd6d56375e4a070539d74352fbc2cfbea32 Mon Sep 17 00:00:00 2001
From: "m.escher" <m.escher@adito.de>
Date: Tue, 4 Dec 2018 09:36:39 +0100
Subject: [PATCH] RecordContainer fix: Contract_entity

---
 entity/Contract_entity/Contract_entity.aod    | 92 +++++++++++++++++--
 .../recordcontainers/db/conditionProcess.js   |  7 ++
 2 files changed, 91 insertions(+), 8 deletions(-)
 create mode 100644 entity/Contract_entity/recordcontainers/db/conditionProcess.js

diff --git a/entity/Contract_entity/Contract_entity.aod b/entity/Contract_entity/Contract_entity.aod
index 82ee5a9c62..bc51b98515 100644
--- a/entity/Contract_entity/Contract_entity.aod
+++ b/entity/Contract_entity/Contract_entity.aod
@@ -8,6 +8,15 @@
   <iconId>VAADIN:FORM</iconId>
   <alias>Data_alias</alias>
   <conditionProcess>%aditoprj%/entity/Contract_entity/conditionProcess.js</conditionProcess>
+  <recordContainer>db</recordContainer>
+  <linkInformation>
+    <linkInformation>
+      <name>feb748e4-0664-455d-be48-dde37a391115</name>
+      <tableName>CONTRACT</tableName>
+      <primaryKey>CONTRACTID</primaryKey>
+      <isUIDTable v="true" />
+    </linkInformation>
+  </linkInformation>
   <entityFields>
     <entityField>
       <name>CONTRACTCODE</name>
@@ -197,12 +206,79 @@
       <name>#INCOMING</name>
     </entityIncomingField>
   </entityFields>
-  <linkInformation>
-    <linkInformation>
-      <name>feb748e4-0664-455d-be48-dde37a391115</name>
-      <tableName>CONTRACT</tableName>
-      <primaryKey>CONTRACTID</primaryKey>
-      <isUIDTable v="true" />
-    </linkInformation>
-  </linkInformation>
+  <recordContainers>
+    <dbRecordContainer>
+      <name>db</name>
+      <alias>Data_alias</alias>
+      <maximumDbRows v="0" />
+      <conditionProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
+      <linkInformation>
+        <linkInformation>
+          <name>c0a3abee-1dd3-4a57-8a73-bb97ad5a286f</name>
+          <tableName>CONTRACT</tableName>
+          <primaryKey>CONTRACTID</primaryKey>
+          <isUIDTable v="true" />
+          <readonly v="false" />
+        </linkInformation>
+      </linkInformation>
+      <recordFieldMappings>
+        <dbRecordFieldMapping>
+          <name>CONTRACTCODE.value</name>
+          <value>CONTRACT.CONTRACTCODE</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>CONTRACTDUE.value</name>
+          <value>CONTRACT.CONTRACTDUE</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>CONTRACTEND.value</name>
+          <value>CONTRACT.CONTRACTEND</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>CONTRACTID.value</name>
+          <value>CONTRACT.CONTRACTID</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>CONTRACTSTART.value</name>
+          <value>CONTRACT.CONTRACTSTART</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>CONTRACTSTATUS.value</name>
+          <value>CONTRACT.CONTRACTSTATUS</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>CONTRACTTYPE.value</name>
+          <value>CONTRACT.CONTRACTTYPE</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_EDIT.value</name>
+          <value>CONTRACT.DATE_EDIT</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_NEW.value</name>
+          <value>CONTRACT.DATE_NEW</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>PAYMENT.value</name>
+          <value>CONTRACT.PAYMENT</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>RELATION_ID.value</name>
+          <value>CONTRACT.RELATION_ID</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>REMARK.value</name>
+          <value>CONTRACT.REMARK</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>USER_EDIT.value</name>
+          <value>CONTRACT.USER_EDIT</value>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>USER_NEW.value</name>
+          <value>CONTRACT.USER_NEW</value>
+        </dbRecordFieldMapping>
+      </recordFieldMappings>
+    </dbRecordContainer>
+  </recordContainers>
 </entity>
diff --git a/entity/Contract_entity/recordcontainers/db/conditionProcess.js b/entity/Contract_entity/recordcontainers/db/conditionProcess.js
new file mode 100644
index 0000000000..fea5817cc1
--- /dev/null
+++ b/entity/Contract_entity/recordcontainers/db/conditionProcess.js
@@ -0,0 +1,7 @@
+import("system.result");
+import("system.vars");
+
+if(vars.exists("$param.RelId_param") && vars.get("$param.RelId_param") != null && vars.get("$param.RelId_param") != "")
+    result.string("CONTRACT.RELATION_ID = ('" + vars.getString("$param.RelId_param") + "')");  
+else
+    result.string("1 = 1");  
\ No newline at end of file
-- 
GitLab