From 550ecf06156ab67896348e8d263f135cdb27edfe Mon Sep 17 00:00:00 2001
From: "v.broens" <v.broens@VBROENS.aditosoftware.local>
Date: Thu, 8 Jul 2021 14:38:38 +0200
Subject: [PATCH] [Projekt: xRM-Marketing][TicketNr.: 1083938][Div. Fehler in
 Interessensgebieten]

---
 entity/InterestLink_entity/InterestLink_entity.aod    |  8 +++++++-
 .../children/onlyactive_param/valueProcess.js         |  4 ++++
 entity/Interest_entity/Interest_entity.aod            |  8 ++++++++
 .../entityfields/onlyactive_param/valueProcess.js     |  4 ++++
 .../recordcontainers/db/conditionProcess.js           | 11 +++++++++++
 5 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 entity/InterestLink_entity/entityfields/interests/children/onlyactive_param/valueProcess.js
 create mode 100644 entity/Interest_entity/entityfields/onlyactive_param/valueProcess.js
 create mode 100644 entity/Interest_entity/recordcontainers/db/conditionProcess.js

diff --git a/entity/InterestLink_entity/InterestLink_entity.aod b/entity/InterestLink_entity/InterestLink_entity.aod
index 0110d444a8..f43c4b6098 100644
--- a/entity/InterestLink_entity/InterestLink_entity.aod
+++ b/entity/InterestLink_entity/InterestLink_entity.aod
@@ -39,8 +39,14 @@
       <dependency>
         <name>dependency</name>
         <entityName>Interest_entity</entityName>
-        <fieldName>#PROVIDER</fieldName>
+        <fieldName>Interests</fieldName>
       </dependency>
+      <children>
+        <entityParameter>
+          <name>OnlyActive_param</name>
+          <valueProcess>%aditoprj%/entity/InterestLink_entity/entityfields/interests/children/onlyactive_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
     </entityConsumer>
     <entityConsumer>
       <name>StatusKeyword</name>
diff --git a/entity/InterestLink_entity/entityfields/interests/children/onlyactive_param/valueProcess.js b/entity/InterestLink_entity/entityfields/interests/children/onlyactive_param/valueProcess.js
new file mode 100644
index 0000000000..b79bed7d64
--- /dev/null
+++ b/entity/InterestLink_entity/entityfields/interests/children/onlyactive_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(true);
\ No newline at end of file
diff --git a/entity/Interest_entity/Interest_entity.aod b/entity/Interest_entity/Interest_entity.aod
index dc9842429d..ae5bab0277 100644
--- a/entity/Interest_entity/Interest_entity.aod
+++ b/entity/Interest_entity/Interest_entity.aod
@@ -56,6 +56,14 @@
         </entityParameter>
       </children>
     </entityConsumer>
+    <entityParameter>
+      <name>OnlyActive_param</name>
+      <valueProcess>%aditoprj%/entity/Interest_entity/entityfields/onlyactive_param/valueProcess.js</valueProcess>
+      <expose v="true" />
+    </entityParameter>
+    <entityProvider>
+      <name>Interests</name>
+    </entityProvider>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Interest_entity/entityfields/onlyactive_param/valueProcess.js b/entity/Interest_entity/entityfields/onlyactive_param/valueProcess.js
new file mode 100644
index 0000000000..c95b5dd1b4
--- /dev/null
+++ b/entity/Interest_entity/entityfields/onlyactive_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(false);
\ No newline at end of file
diff --git a/entity/Interest_entity/recordcontainers/db/conditionProcess.js b/entity/Interest_entity/recordcontainers/db/conditionProcess.js
new file mode 100644
index 0000000000..1c67277a0a
--- /dev/null
+++ b/entity/Interest_entity/recordcontainers/db/conditionProcess.js
@@ -0,0 +1,11 @@
+import("system.result");
+import("system.vars");
+import("Sql_lib");
+import("KeywordRegistry_basic");
+
+var cond = newWhere();
+if(vars.getString("$param.OnlyActive_param") == "true")
+{
+    cond.and("INTEREST.STATUS", $KeywordRegistry.interestStatus$inactive(), SqlBuilder.NOT_EQUAL());
+}
+result.string(cond.toString());
\ No newline at end of file
-- 
GitLab