From 2be209bbedfd6f26e5582f53ee102149f83d0759 Mon Sep 17 00:00:00 2001
From: "b.ulrich" <b.ulrich@adito.de>
Date: Tue, 22 Dec 2020 12:26:32 +0100
Subject: [PATCH] [Projekt: Entwicklung - xRM][TicketNr.:
 1069470][[CONTACT_ENTITY] Eigenschaften einbauen]

---
 .../AttributeRelation_entity.aod              |  6 ++
 entity/Contact_entity/Contact_entity.aod      | 90 ++++++++++++-------
 .../objectrowid_param/valueProcess.js         |  4 +
 .../children/objecttype_param/valueProcess.js |  4 +
 .../showdsgvomessage_param/valueProcess.js    |  5 ++
 .../entityfields/attributes/onValidation.js   |  6 ++
 .../ContactEdit_view/ContactEdit_view.aod     |  5 ++
 7 files changed, 87 insertions(+), 33 deletions(-)
 create mode 100644 entity/Contact_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
 create mode 100644 entity/Contact_entity/entityfields/attributes/children/objecttype_param/valueProcess.js
 create mode 100644 entity/Contact_entity/entityfields/attributes/children/showdsgvomessage_param/valueProcess.js
 create mode 100644 entity/Contact_entity/entityfields/attributes/onValidation.js

diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod
index 6a92d5391d..566ecc7850 100644
--- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod
+++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod
@@ -244,6 +244,12 @@
           <fieldName>Attributes</fieldName>
           <isConsumer v="false" />
         </entityDependency>
+        <entityDependency>
+          <name>92855510-92c8-4837-85d3-072396f5f7f6</name>
+          <entityName>Contact_entity</entityName>
+          <fieldName>Attributes</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
       </dependencies>
     </entityProvider>
     <entityField>
diff --git a/entity/Contact_entity/Contact_entity.aod b/entity/Contact_entity/Contact_entity.aod
index 41a386bd8d..4fb1230acc 100644
--- a/entity/Contact_entity/Contact_entity.aod
+++ b/entity/Contact_entity/Contact_entity.aod
@@ -65,17 +65,17 @@
     </entityField>
     <entityConsumer>
       <name>Organisations</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>Organisation_entity</entityName>
-        <fieldName>WithPersonIdFilter</fieldName>
-      </dependency>
       <children>
         <entityParameter>
           <name>ExcludeOrganisationsByPersonId</name>
           <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisations/children/excludeorganisationsbypersonid/valueProcess.js</valueProcess>
         </entityParameter>
       </children>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Organisation_entity</entityName>
+        <fieldName>WithPersonIdFilter</fieldName>
+      </dependency>
     </entityConsumer>
     <entityParameter>
       <name>PersonId_param</name>
@@ -86,6 +86,12 @@
       <name>PersonRelated</name>
       <targetContextField>targetContext</targetContextField>
       <targetIdField>CONTACTID</targetIdField>
+      <children>
+        <entityParameter>
+          <name>OwnContactId_param</name>
+          <expose v="false" />
+        </entityParameter>
+      </children>
       <dependencies>
         <entityDependency>
           <name>14975dad-907c-4f8c-bd39-243508ede721</name>
@@ -94,12 +100,6 @@
           <isConsumer v="false" />
         </entityDependency>
       </dependencies>
-      <children>
-        <entityParameter>
-          <name>OwnContactId_param</name>
-          <expose v="false" />
-        </entityParameter>
-      </children>
     </entityProvider>
     <entityField>
       <name>ADDRESS_ID</name>
@@ -115,31 +115,31 @@
     </entityField>
     <entityConsumer>
       <name>Communications</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>Communication_entity</entityName>
-        <fieldName>AllCommunications</fieldName>
-      </dependency>
       <children>
         <entityParameter>
           <name>ContactId_param</name>
           <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/communications/children/contactid_param/valueProcess.js</valueProcess>
         </entityParameter>
       </children>
-    </entityConsumer>
-    <entityConsumer>
-      <name>ContactAddresses</name>
       <dependency>
         <name>dependency</name>
-        <entityName>Address_entity</entityName>
-        <fieldName>ContactAddresses</fieldName>
+        <entityName>Communication_entity</entityName>
+        <fieldName>AllCommunications</fieldName>
       </dependency>
+    </entityConsumer>
+    <entityConsumer>
+      <name>ContactAddresses</name>
       <children>
         <entityParameter>
           <name>ContactId_param</name>
           <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/contactaddresses/children/contactid_param/valueProcess.js</valueProcess>
         </entityParameter>
       </children>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Address_entity</entityName>
+        <fieldName>ContactAddresses</fieldName>
+      </dependency>
     </entityConsumer>
     <entityField>
       <name>LANGUAGE</name>
@@ -163,6 +163,13 @@
       <targetContextField>targetContext</targetContextField>
       <targetIdField>CONTACTID</targetIdField>
       <titlePlural>Other Contactroles</titlePlural>
+      <children>
+        <entityParameter>
+          <name>PersonId_param</name>
+          <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/personscontactsexceptown/children/personid_param/valueProcess.js</valueProcess>
+          <expose v="false" />
+        </entityParameter>
+      </children>
       <dependencies>
         <entityDependency>
           <name>34cc85f4-5555-4631-94fc-f3ad35b7ce7e</name>
@@ -171,13 +178,6 @@
           <isConsumer v="false" />
         </entityDependency>
       </dependencies>
-      <children>
-        <entityParameter>
-          <name>PersonId_param</name>
-          <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/personscontactsexceptown/children/personid_param/valueProcess.js</valueProcess>
-          <expose v="false" />
-        </entityParameter>
-      </children>
     </entityProvider>
     <entityParameter>
       <name>OwnContactId_param</name>
@@ -198,17 +198,17 @@
     </entityField>
     <entityConsumer>
       <name>KeywordContactStates</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>KeywordEntry_entity</entityName>
-        <fieldName>SpecificContainerKeywords</fieldName>
-      </dependency>
       <children>
         <entityParameter>
           <name>ContainerName_param</name>
           <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js</valueProcess>
         </entityParameter>
       </children>
+      <dependency>
+        <name>dependency</name>
+        <entityName>KeywordEntry_entity</entityName>
+        <fieldName>SpecificContainerKeywords</fieldName>
+      </dependency>
     </entityConsumer>
     <entityParameter>
       <name>LanguageKey_param</name>
@@ -255,6 +255,30 @@
       <name>#PROVIDER_AGGREGATES</name>
       <useAggregates v="true" />
     </entityProvider>
+    <entityConsumer>
+      <name>Attributes</name>
+      <onValidation>%aditoprj%/entity/Contact_entity/entityfields/attributes/onValidation.js</onValidation>
+      <children>
+        <entityParameter>
+          <name>ShowDsgvoMessage_param</name>
+          <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/attributes/children/showdsgvomessage_param/valueProcess.js</valueProcess>
+          <mandatory v="true" />
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectType_param</name>
+          <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/attributes/children/objecttype_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectRowId_param</name>
+          <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+      <dependency>
+        <name>dependency</name>
+        <entityName>AttributeRelation_entity</entityName>
+        <fieldName>AttributeRelations</fieldName>
+      </dependency>
+    </entityConsumer>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Contact_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js b/entity/Contact_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
new file mode 100644
index 0000000000..7b6137b4d1
--- /dev/null
+++ b/entity/Contact_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.get("$field.CONTACTID"));
\ No newline at end of file
diff --git a/entity/Contact_entity/entityfields/attributes/children/objecttype_param/valueProcess.js b/entity/Contact_entity/entityfields/attributes/children/objecttype_param/valueProcess.js
new file mode 100644
index 0000000000..eabd0960cd
--- /dev/null
+++ b/entity/Contact_entity/entityfields/attributes/children/objecttype_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("Context_lib");
+
+result.string("Person");
diff --git a/entity/Contact_entity/entityfields/attributes/children/showdsgvomessage_param/valueProcess.js b/entity/Contact_entity/entityfields/attributes/children/showdsgvomessage_param/valueProcess.js
new file mode 100644
index 0000000000..fce9fde135
--- /dev/null
+++ b/entity/Contact_entity/entityfields/attributes/children/showdsgvomessage_param/valueProcess.js
@@ -0,0 +1,5 @@
+import("system.vars");
+import("system.neon");
+import("system.result");
+
+result.string(vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW);
\ No newline at end of file
diff --git a/entity/Contact_entity/entityfields/attributes/onValidation.js b/entity/Contact_entity/entityfields/attributes/onValidation.js
new file mode 100644
index 0000000000..48155ac127
--- /dev/null
+++ b/entity/Contact_entity/entityfields/attributes/onValidation.js
@@ -0,0 +1,6 @@
+import("Context_lib");
+import("system.vars");
+import("Attribute_lib");
+import("system.result");
+
+result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.CONTACTID"), "Person", "Attributes"));
\ No newline at end of file
diff --git a/neonView/ContactEdit_view/ContactEdit_view.aod b/neonView/ContactEdit_view/ContactEdit_view.aod
index 1ba399ccaf..401f3bb64a 100644
--- a/neonView/ContactEdit_view/ContactEdit_view.aod
+++ b/neonView/ContactEdit_view/ContactEdit_view.aod
@@ -44,5 +44,10 @@
       <entityField>Communications</entityField>
       <view>CommunicationMultiEdit_view</view>
     </neonViewReference>
+    <neonViewReference>
+      <name>cd3c14c9-f189-483b-9bcd-f3125c9dd77a</name>
+      <entityField>Attributes</entityField>
+      <view>AttributeRelationMultiEdit_view</view>
+    </neonViewReference>
   </children>
 </neonView>
-- 
GitLab