From 35f4e271dbf9b9b5b43c06953c561b25ed76df81 Mon Sep 17 00:00:00 2001
From: Sebastian Listl <s.listl@adito.de>
Date: Mon, 9 Nov 2020 17:08:23 +0100
Subject: [PATCH] #1063444 Communication address placeholder

---
 .../Data_alias/basic/2020.2.2/changelog.xml   |  5 ++
 ...insert_commMediumTitleKeywordAttribute.xml | 55 ++++++++++++
 .liquibase/Data_alias/changelog.xml           |  1 +
 .../Communication_entity.aod                  | 87 ++++++++++---------
 .../entityfields/addr/titleProcess.js         | 10 +++
 .../_____LANGUAGE_EXTRA.aod                   |  3 +
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     |  4 +
 .../_____LANGUAGE_en/_____LANGUAGE_en.aod     |  3 +
 8 files changed, 125 insertions(+), 43 deletions(-)
 create mode 100644 .liquibase/Data_alias/basic/2020.2.2/changelog.xml
 create mode 100644 .liquibase/Data_alias/basic/2020.2.2/insert_commMediumTitleKeywordAttribute.xml
 create mode 100644 entity/Communication_entity/entityfields/addr/titleProcess.js

diff --git a/.liquibase/Data_alias/basic/2020.2.2/changelog.xml b/.liquibase/Data_alias/basic/2020.2.2/changelog.xml
new file mode 100644
index 0000000000..c4de83cc61
--- /dev/null
+++ b/.liquibase/Data_alias/basic/2020.2.2/changelog.xml
@@ -0,0 +1,5 @@
+<?xml version="1.1" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+    <include relativeToChangelogFile="true" file="insert_commMediumTitleKeywordAttribute.xml"/>
+</databaseChangeLog>
diff --git a/.liquibase/Data_alias/basic/2020.2.2/insert_commMediumTitleKeywordAttribute.xml b/.liquibase/Data_alias/basic/2020.2.2/insert_commMediumTitleKeywordAttribute.xml
new file mode 100644
index 0000000000..e67d1cc992
--- /dev/null
+++ b/.liquibase/Data_alias/basic/2020.2.2/insert_commMediumTitleKeywordAttribute.xml
@@ -0,0 +1,55 @@
+<?xml version="1.1" encoding="UTF-8" standalone="no"?>
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+  <changeSet author="s.listl" id="deb46cd2-c2e7-424b-93a1-052cd0a5aef7">
+      <insert tableName="AB_KEYWORD_ATTRIBUTE">
+          <column name="AB_KEYWORD_ATTRIBUTEID" value="ace00630-1e07-4615-8d61-2478995538fa"/>
+          <column name="CONTAINER" value="CommunicationMedium"/>
+          <column name="KIND" value="CHAR_VALUE"/>
+          <column name="NAME" value="placeholderTitle"/>
+      </insert>
+      <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+          <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="ebf5a52c-34db-4394-9fc1-21dfbdc3c6ea"/>
+          <column name="AB_KEYWORD_ATTRIBUTE_ID" value="ace00630-1e07-4615-8d61-2478995538fa"/>
+          <column name="AB_KEYWORD_ENTRY_ID" value="cc16d938-b95f-4e07-a3b4-73f8524bb664"/>
+          <column name="CHAR_VALUE" value="Phone number"/>
+      </insert>
+      <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+          <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="5a2bb861-31c8-471d-8fb9-a3c28d589b9f"/>
+          <column name="AB_KEYWORD_ATTRIBUTE_ID" value="ace00630-1e07-4615-8d61-2478995538fa"/>
+          <column name="AB_KEYWORD_ENTRY_ID" value="66950de5-fa8b-465c-8db1-4eb7aac98bd3"/>
+          <column name="CHAR_VALUE" value="Email address"/>
+      </insert>
+      <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+          <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="c860637f-4182-4cc4-9879-7ed3d009aee4"/>
+          <column name="AB_KEYWORD_ATTRIBUTE_ID" value="ace00630-1e07-4615-8d61-2478995538fa"/>
+          <column name="AB_KEYWORD_ENTRY_ID" value="aa2b9cc9-3e87-4fe9-98a2-a4e417a3324f"/>
+          <column name="CHAR_VALUE" value="Phone number"/>
+      </insert>
+      <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+          <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="def9c03f-4f8b-4158-9f9c-4f2c6f1f52be"/>
+          <column name="AB_KEYWORD_ATTRIBUTE_ID" value="ace00630-1e07-4615-8d61-2478995538fa"/>
+          <column name="AB_KEYWORD_ENTRY_ID" value="cfebe176-0a64-428d-b0ec-bba454d2ca3e"/>
+          <column name="CHAR_VALUE" value="URL"/>
+      </insert>
+      <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+          <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="bf7be765-ebcc-409f-9c81-66665b6b55f6"/>
+          <column name="AB_KEYWORD_ATTRIBUTE_ID" value="ace00630-1e07-4615-8d61-2478995538fa"/>
+          <column name="AB_KEYWORD_ENTRY_ID" value="d80c3689-7e0a-45ac-801d-91d199c08bd5"/>
+          <column name="CHAR_VALUE" value="URL"/>
+      </insert>
+      <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+          <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="9fc7f919-b04c-40f3-8124-9e1d4d8198f5"/>
+          <column name="AB_KEYWORD_ATTRIBUTE_ID" value="ace00630-1e07-4615-8d61-2478995538fa"/>
+          <column name="AB_KEYWORD_ENTRY_ID" value="e6c36792-763d-44f8-8afe-157c8f158ef8"/>
+          <column name="CHAR_VALUE" value="URL"/>
+      </insert>
+      <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
+          <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="5d64759f-acd2-4dbc-9df3-c38bceaf8f6b"/>
+          <column name="AB_KEYWORD_ATTRIBUTE_ID" value="ace00630-1e07-4615-8d61-2478995538fa"/>
+          <column name="AB_KEYWORD_ENTRY_ID" value="7abf7fc5-08a1-4bae-b0ca-ec5e406d154c"/>
+          <column name="CHAR_VALUE" value="URL"/>
+      </insert>
+  </changeSet>
+</databaseChangeLog>
\ No newline at end of file
diff --git a/.liquibase/Data_alias/changelog.xml b/.liquibase/Data_alias/changelog.xml
index 9d1ca6c557..3f25ca1dbb 100644
--- a/.liquibase/Data_alias/changelog.xml
+++ b/.liquibase/Data_alias/changelog.xml
@@ -17,6 +17,7 @@
     <include relativeToChangelogFile="true" file="basic/2020.1.3/changelog.xml"/>
     <include relativeToChangelogFile="true" file="basic/2020.2.0/changelog.xml"/>
     <include relativeToChangelogFile="true" file="basic/2020.2.1/changelog.xml"/>
+    <include relativeToChangelogFile="true" file="basic/2020.2.2/changelog.xml"/>
 
     <!--enable this only when you definetly want to overwrite the existing data with demo records:-->
     <!--<include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/>-->
diff --git a/entity/Communication_entity/Communication_entity.aod b/entity/Communication_entity/Communication_entity.aod
index dbc7bf89b3..f931c15531 100644
--- a/entity/Communication_entity/Communication_entity.aod
+++ b/entity/Communication_entity/Communication_entity.aod
@@ -13,6 +13,7 @@
       <title>${COMM_ADDRESS}</title>
       <contentTypeProcess>%aditoprj%/entity/Communication_entity/entityfields/addr/contentTypeProcess.js</contentTypeProcess>
       <mandatory v="true" />
+      <titleProcess>%aditoprj%/entity/Communication_entity/entityfields/addr/titleProcess.js</titleProcess>
       <valueProcess>%aditoprj%/entity/Communication_entity/entityfields/addr/valueProcess.js</valueProcess>
       <onValidation>%aditoprj%/entity/Communication_entity/entityfields/addr/onValidation.js</onValidation>
     </entityField>
@@ -62,6 +63,27 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
       <name>AllCommunications</name>
       <documentation>%aditoprj%/entity/Communication_entity/entityfields/allcommunications/documentation.adoc</documentation>
       <recordContainer>db</recordContainer>
+      <children>
+        <entityParameter>
+          <name>CommCategory_param</name>
+          <expose v="true" />
+          <description>TODO: expose auf false. aktuell wird der Code nicht ausgeführt, wenn Expose false ist.</description>
+        </entityParameter>
+        <entityParameter>
+          <name>ContactId_param</name>
+          <expose v="true" />
+          <description>This parameter is used for specifing a related "CONTACTID" to a COMMUNICATION-entry. 
+Usually this is used for filtering COMMUNICATION-entries by a specified contact or creating a new entry that is related to a contact.</description>
+        </entityParameter>
+        <entityParameter>
+          <name>Address_param</name>
+          <expose v="false" />
+        </entityParameter>
+        <entityParameter>
+          <name>AdditionalContactIds_param</name>
+          <expose v="false" />
+        </entityParameter>
+      </children>
       <dependencies>
         <entityDependency>
           <name>070b2457-3766-4c8a-b43f-a2bf7c9ef638</name>
@@ -88,10 +110,16 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
           <isConsumer v="false" />
         </entityDependency>
       </dependencies>
+    </entityProvider>
+    <entityProvider>
+      <name>PhoneCommunications</name>
+      <documentation>%aditoprj%/entity/Communication_entity/entityfields/phonecommunications/documentation.adoc</documentation>
+      <recordContainer>db</recordContainer>
       <children>
         <entityParameter>
           <name>CommCategory_param</name>
-          <expose v="true" />
+          <valueProcess>%aditoprj%/entity/Communication_entity/entityfields/phonecommunications/children/commcategory_param/valueProcess.js</valueProcess>
+          <expose v="false" />
           <description>TODO: expose auf false. aktuell wird der Code nicht ausgeführt, wenn Expose false ist.</description>
         </entityParameter>
         <entityParameter>
@@ -102,18 +130,14 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
         </entityParameter>
         <entityParameter>
           <name>Address_param</name>
-          <expose v="false" />
+          <expose v="true" />
+          <mandatory v="false" />
         </entityParameter>
         <entityParameter>
           <name>AdditionalContactIds_param</name>
           <expose v="false" />
         </entityParameter>
       </children>
-    </entityProvider>
-    <entityProvider>
-      <name>PhoneCommunications</name>
-      <documentation>%aditoprj%/entity/Communication_entity/entityfields/phonecommunications/documentation.adoc</documentation>
-      <recordContainer>db</recordContainer>
       <dependencies>
         <entityDependency>
           <name>7382242a-aa18-4a31-ab77-69a79f2b97b8</name>
@@ -128,10 +152,16 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
           <isConsumer v="false" />
         </entityDependency>
       </dependencies>
+    </entityProvider>
+    <entityProvider>
+      <name>EmailCommunications</name>
+      <documentation>%aditoprj%/entity/Communication_entity/entityfields/emailcommunications/documentation.adoc</documentation>
+      <recordContainer>db</recordContainer>
       <children>
         <entityParameter>
           <name>CommCategory_param</name>
-          <valueProcess>%aditoprj%/entity/Communication_entity/entityfields/phonecommunications/children/commcategory_param/valueProcess.js</valueProcess>
+          <title></title>
+          <valueProcess>%aditoprj%/entity/Communication_entity/entityfields/emailcommunications/children/commcategory_param/valueProcess.js</valueProcess>
           <expose v="false" />
           <description>TODO: expose auf false. aktuell wird der Code nicht ausgeführt, wenn Expose false ist.</description>
         </entityParameter>
@@ -143,19 +173,13 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
         </entityParameter>
         <entityParameter>
           <name>Address_param</name>
-          <expose v="true" />
-          <mandatory v="false" />
+          <expose v="false" />
         </entityParameter>
         <entityParameter>
           <name>AdditionalContactIds_param</name>
           <expose v="false" />
         </entityParameter>
       </children>
-    </entityProvider>
-    <entityProvider>
-      <name>EmailCommunications</name>
-      <documentation>%aditoprj%/entity/Communication_entity/entityfields/emailcommunications/documentation.adoc</documentation>
-      <recordContainer>db</recordContainer>
       <dependencies>
         <entityDependency>
           <name>ecfbf518-fe92-4661-8ebe-e2d3c8d259e1</name>
@@ -182,29 +206,6 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
           <isConsumer v="false" />
         </entityDependency>
       </dependencies>
-      <children>
-        <entityParameter>
-          <name>CommCategory_param</name>
-          <title></title>
-          <valueProcess>%aditoprj%/entity/Communication_entity/entityfields/emailcommunications/children/commcategory_param/valueProcess.js</valueProcess>
-          <expose v="false" />
-          <description>TODO: expose auf false. aktuell wird der Code nicht ausgeführt, wenn Expose false ist.</description>
-        </entityParameter>
-        <entityParameter>
-          <name>ContactId_param</name>
-          <expose v="true" />
-          <description>This parameter is used for specifing a related "CONTACTID" to a COMMUNICATION-entry. 
-Usually this is used for filtering COMMUNICATION-entries by a specified contact or creating a new entry that is related to a contact.</description>
-        </entityParameter>
-        <entityParameter>
-          <name>Address_param</name>
-          <expose v="false" />
-        </entityParameter>
-        <entityParameter>
-          <name>AdditionalContactIds_param</name>
-          <expose v="false" />
-        </entityParameter>
-      </children>
     </entityProvider>
     <entityParameter>
       <name>CommCategory_param</name>
@@ -218,11 +219,6 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
     </entityParameter>
     <entityConsumer>
       <name>KeywordMediums</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>KeywordEntry_entity</entityName>
-        <fieldName>SpecificContainerKeywords</fieldName>
-      </dependency>
       <children>
         <entityParameter>
           <name>ContainerName_param</name>
@@ -230,6 +226,11 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
           <expose v="false" />
         </entityParameter>
       </children>
+      <dependency>
+        <name>dependency</name>
+        <entityName>KeywordEntry_entity</entityName>
+        <fieldName>SpecificContainerKeywords</fieldName>
+      </dependency>
     </entityConsumer>
     <entityField>
       <name>USER_NEW</name>
diff --git a/entity/Communication_entity/entityfields/addr/titleProcess.js b/entity/Communication_entity/entityfields/addr/titleProcess.js
new file mode 100644
index 0000000000..8bacbaa9a7
--- /dev/null
+++ b/entity/Communication_entity/entityfields/addr/titleProcess.js
@@ -0,0 +1,10 @@
+import("system.translate");
+import("system.result");
+import("KeywordRegistry_basic");
+import("Keyword_lib");
+import("system.vars");
+
+var commMedium = vars.get("$field.MEDIUM_ID");
+var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(commMedium, $KeywordRegistry.communicationMedium());
+if (keywordAttributes && keywordAttributes.placeholderTitle)
+    result.string(translate.text(keywordAttributes.placeholderTitle));
\ No newline at end of file
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index 3439544cfe..7b27a5c741 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -7296,6 +7296,9 @@
     <entry>
       <key>Outstanding Amount</key>
     </entry>
+    <entry>
+      <key>Start marketing mailing</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
   <sqlModels>
diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
index d68c0ad4d7..e1b810a066 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -3071,6 +3071,10 @@
       <key>Kgs</key>
       <value>Kg</value>
     </entry>
+    <entry>
+      <key>Email address</key>
+      <value>E-Mail Adresse</value>
+    </entry>
     <entry>
       <key>Australia</key>
       <value>Australien</value>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index cf8d0df31f..221f4b4a72 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -7377,6 +7377,9 @@
     <entry>
       <key>Outstanding Amount</key>
     </entry>
+    <entry>
+      <key>Start marketing mailing</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
-- 
GitLab