From 0079946a418c74c760669d693440e8ec353917ff Mon Sep 17 00:00:00 2001
From: Sophia Leierseder <s.leierseder@adito.de>
Date: Tue, 11 Jun 2019 11:05:30 +0200
Subject: [PATCH] change medium keyword commrestriction

---
 .../AditoBasic/init_CommunicationMedium.xml   | 22 ------
 .../init/data/AditoBasic/ab_keyword_entry.xml |  1 -
 .../ab_keyword_entry/init_CommRestriction.xml | 76 -------------------
 .../CommRestriction_Entity.aod                | 10 ++-
 .../containername_param/valueProcess.js       |  2 +-
 .../employee_involved/displayValueProcess.js  |  5 ++
 .../employee_involved/valueProcess.js         |  7 ++
 .../medium/displayValueProcess.js             |  2 +-
 .../entityfields/startdate/valueProcess.js    |  7 ++
 .../_____LANGUAGE_EXTRA.aod                   |  6 ++
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     | 12 ++-
 .../_____LANGUAGE_en/_____LANGUAGE_en.aod     |  6 ++
 .../CommRestriction/CommRestriction.aod       |  2 +-
 .../CommRestrictionFilter_view.aod            |  2 +
 14 files changed, 52 insertions(+), 108 deletions(-)
 delete mode 100644 .liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_entry/init_CommRestriction.xml
 create mode 100644 entity/CommRestriction_Entity/entityfields/employee_involved/displayValueProcess.js
 create mode 100644 entity/CommRestriction_Entity/entityfields/employee_involved/valueProcess.js
 create mode 100644 entity/CommRestriction_Entity/entityfields/startdate/valueProcess.js

diff --git a/.liquibase/Data_alias/basic/2019.2/AditoBasic/init_CommunicationMedium.xml b/.liquibase/Data_alias/basic/2019.2/AditoBasic/init_CommunicationMedium.xml
index 9615bca2323..14da74fff97 100644
--- a/.liquibase/Data_alias/basic/2019.2/AditoBasic/init_CommunicationMedium.xml
+++ b/.liquibase/Data_alias/basic/2019.2/AditoBasic/init_CommunicationMedium.xml
@@ -103,28 +103,6 @@
             <column name="AB_KEYWORD_ATTRIBUTE_ID" value="3ea2ea72-e615-4e77-befb-e664fa5ec4e1"/>
             <column name="CHAR_VALUE" value="LINK"/>
         </insert>
-        <insert tableName="AB_KEYWORD_ENTRY">
-            <column name="AB_KEYWORD_ENTRYID" value="4bd27b5d-d41f-49d0-877a-3367d2016505"/>
-
-            <column name="KEYID" value="197b1875-1810-41e4-9980-e332d9938a54"/>
-            <column name="TITLE" value="Letter"/>
-            <column name="CONTAINER" value="CommunicationMedium"/>
-            <column name="SORTING" valueNumeric="4"/>
-            <column name="ISACTIVE" valueNumeric="1"/>
-            <column name="ISESSENTIAL" valueNumeric="0"/>
-        </insert>
-        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
-            <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="135eef4c-4c98-4f6a-8b9d-a5dee5b60d31"/>
-            <column name="AB_KEYWORD_ENTRY_ID" value="4bd27b5d-d41f-49d0-877a-3367d2016505"/>
-            <column name="AB_KEYWORD_ATTRIBUTE_ID" value="7250ff28-1d48-41cc-bb36-8c33ace341bb"/>
-            <column name="CHAR_VALUE" value="LETTER"/>
-        </insert>
-        <insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
-            <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="42e5f9eb-a1f7-4aba-81b6-507a935de624"/>
-            <column name="AB_KEYWORD_ENTRY_ID" value="4bd27b5d-d41f-49d0-877a-3367d2016505"/>
-            <column name="AB_KEYWORD_ATTRIBUTE_ID" value="3ea2ea72-e615-4e77-befb-e664fa5ec4e1"/>
-            <column name="CHAR_VALUE" value="LETTER"/>
-        </insert>
         <rollback>
             <delete tableName="AB_KEYWORD_ATTRIBUTE">
                 <where>AB_KEYWORD_ATTRIBUTEID = ?</where>
diff --git a/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_entry.xml b/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_entry.xml
index ae358160a4f..bf57d6e5328 100644
--- a/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_entry.xml
+++ b/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_entry.xml
@@ -25,5 +25,4 @@
     <include relativeToChangelogFile="true" file="ab_keyword_entry/init_TaskType.xml"/>
     <include relativeToChangelogFile="true" file="ab_keyword_entry/init_AttributeType.xml"/>
     <include relativeToChangelogFile="true" file="ab_keyword_entry/init_SalesprojectProbability.xml"/>
-    <include relativeToChangelogFile="true" file="ab_keyword_entry/init_CommRestriction.xml"/>
 </databaseChangeLog>
diff --git a/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_entry/init_CommRestriction.xml b/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_entry/init_CommRestriction.xml
deleted file mode 100644
index d75f7dddd43..00000000000
--- a/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_entry/init_CommRestriction.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.1" encoding="UTF-8" standalone="no"?>
-<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
-    <changeSet author="s.leierseder" id="b5c2a43b-ad6c-4b28-b991-3f4c767ec561">
-        
-        <insert tableName="AB_KEYWORD_ENTRY">
-            <column name="AB_KEYWORD_ENTRYID" value="e4598fe0-2e01-4a82-9429-c8584cfe36fc"/>
-
-            <column name="KEYID" value="c6c916c0-0656-4c4d-b238-3e745a515725"/>
-            <column name="TITLE" value="No calls"/>
-            <column name="CONTAINER" value="CommRestriction"/>
-            <column name="SORTING" valueNumeric="0"/>
-            <column name="ISACTIVE" valueNumeric="1"/>
-            <column name="ISESSENTIAL" valueNumeric="0"/>
-        </insert>
-        
-        <insert tableName="AB_KEYWORD_ENTRY">
-            <column name="AB_KEYWORD_ENTRYID" value="8d79901e-b729-41db-8d6f-848231ac638f"/>
-
-            <column name="KEYID" value="10332e37-e459-4044-9949-2a45dcfa4e87"/>
-            <column name="TITLE" value="No serial mails"/>
-            <column name="CONTAINER" value="CommRestriction"/>
-            <column name="SORTING" valueNumeric="1"/>
-            <column name="ISACTIVE" valueNumeric="1"/>
-            <column name="ISESSENTIAL" valueNumeric="0"/>
-        </insert>
-        
-        <insert tableName="AB_KEYWORD_ENTRY">
-            <column name="AB_KEYWORD_ENTRYID" value="c8c6ca12-852b-4e71-b27f-ae7234fc2808"/>
-
-            <column name="KEYID" value="5c45b90f-133d-40cd-805c-508ad84a63a0"/>
-            <column name="TITLE" value="No internet advertising"/>
-            <column name="CONTAINER" value="CommRestriction"/>
-            <column name="SORTING" valueNumeric="2"/>
-            <column name="ISACTIVE" valueNumeric="1"/>
-            <column name="ISESSENTIAL" valueNumeric="0"/>
-        </insert>
-        
-        <insert tableName="AB_KEYWORD_ENTRY">
-            <column name="AB_KEYWORD_ENTRYID" value="40a320b3-d1c3-4427-aa2f-ea1615266493"/>
-
-            <column name="KEYID" value="04732d01-fbf5-40cb-a176-a9ad5595fc9d"/>
-            <column name="TITLE" value="No serial letter"/>
-            <column name="CONTAINER" value="CommRestriction"/>
-            <column name="SORTING" valueNumeric="3"/>
-            <column name="ISACTIVE" valueNumeric="1"/>
-            <column name="ISESSENTIAL" valueNumeric="0"/>
-        </insert>
-        
-        <rollback>
-            <delete tableName="AB_KEYWORD_ENTRY">
-                <where>AB_KEYWORD_ENTRYID = ?</where>
-                <whereParams>
-                    <param value="e4598fe0-2e01-4a82-9429-c8584cfe36fc" />
-                </whereParams>
-            </delete>
-            <delete tableName="AB_KEYWORD_ENTRY">
-                <where>AB_KEYWORD_ENTRYID = ?</where>
-                <whereParams>
-                    <param value="8d79901e-b729-41db-8d6f-848231ac638f" />
-                </whereParams>
-            </delete>
-            <delete tableName="AB_KEYWORD_ENTRY">
-                <where>AB_KEYWORD_ENTRYID = ?</where>
-                <whereParams>
-                    <param value="c8c6ca12-852b-4e71-b27f-ae7234fc2808" />
-                </whereParams>
-            </delete>
-            <delete tableName="AB_KEYWORD_ENTRY">
-                <where>AB_KEYWORD_ENTRYID = ?</where>
-                <whereParams>
-                    <param value="40a320b3-d1c3-4427-aa2f-ea1615266493" />
-                </whereParams>
-            </delete>
-        </rollback>
-    </changeSet>
-</databaseChangeLog>
diff --git a/entity/CommRestriction_Entity/CommRestriction_Entity.aod b/entity/CommRestriction_Entity/CommRestriction_Entity.aod
index cb12498ce61..ffe13083857 100644
--- a/entity/CommRestriction_Entity/CommRestriction_Entity.aod
+++ b/entity/CommRestriction_Entity/CommRestriction_Entity.aod
@@ -2,6 +2,8 @@
 <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.6">
   <name>CommRestriction_Entity</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <title>Advertising ban</title>
+  <titlePlural>Advertising bans</titlePlural>
   <recordContainer>db</recordContainer>
   <entityFields>
     <entityProvider>
@@ -14,8 +16,9 @@
     </entityField>
     <entityField>
       <name>MEDIUM</name>
-      <title>Medium</title>
+      <title>Advertising ban</title>
       <consumer>CommRestrictionMedium</consumer>
+      <mandatory v="true" />
       <displayValueProcess>%aditoprj%/entity/CommRestriction_Entity/entityfields/medium/displayValueProcess.js</displayValueProcess>
     </entityField>
     <entityField>
@@ -23,11 +26,14 @@
       <title>Valid from</title>
       <contentType>DATE</contentType>
       <resolution>DAY</resolution>
+      <valueProcess>%aditoprj%/entity/CommRestriction_Entity/entityfields/startdate/valueProcess.js</valueProcess>
     </entityField>
     <entityField>
       <name>EMPLOYEE_INVOLVED</name>
-      <title>Employee responsible</title>
+      <title>Responsible</title>
       <consumer>EmployeeInvolved</consumer>
+      <valueProcess>%aditoprj%/entity/CommRestriction_Entity/entityfields/employee_involved/valueProcess.js</valueProcess>
+      <displayValueProcess>%aditoprj%/entity/CommRestriction_Entity/entityfields/employee_involved/displayValueProcess.js</displayValueProcess>
     </entityField>
     <entityField>
       <name>REASON</name>
diff --git a/entity/CommRestriction_Entity/entityfields/commrestrictionmedium/children/containername_param/valueProcess.js b/entity/CommRestriction_Entity/entityfields/commrestrictionmedium/children/containername_param/valueProcess.js
index 17d4b5b33ba..ea5a5e85147 100644
--- a/entity/CommRestriction_Entity/entityfields/commrestrictionmedium/children/containername_param/valueProcess.js
+++ b/entity/CommRestriction_Entity/entityfields/commrestrictionmedium/children/containername_param/valueProcess.js
@@ -2,4 +2,4 @@ import("system.result");
 import("Keyword_lib");
 import("KeywordRegistry_basic");
 
-result.string($KeywordRegistry.commRestriction());
\ No newline at end of file
+result.string($KeywordRegistry.communicationMedium());
\ No newline at end of file
diff --git a/entity/CommRestriction_Entity/entityfields/employee_involved/displayValueProcess.js b/entity/CommRestriction_Entity/entityfields/employee_involved/displayValueProcess.js
new file mode 100644
index 00000000000..53e2f557005
--- /dev/null
+++ b/entity/CommRestriction_Entity/entityfields/employee_involved/displayValueProcess.js
@@ -0,0 +1,5 @@
+import("system.vars");
+import("system.result");
+import("Contact_lib");
+
+result.string(ContactUtils.getTitleByContactId(vars.get("$field.EMPLOYEE_INVOLVED")));
\ No newline at end of file
diff --git a/entity/CommRestriction_Entity/entityfields/employee_involved/valueProcess.js b/entity/CommRestriction_Entity/entityfields/employee_involved/valueProcess.js
new file mode 100644
index 00000000000..0d83e155507
--- /dev/null
+++ b/entity/CommRestriction_Entity/entityfields/employee_involved/valueProcess.js
@@ -0,0 +1,7 @@
+import("system.result");
+import("system.neon");
+import("system.vars");
+import("Employee_lib");
+
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value"))
+    result.string(EmployeeUtils.getCurrentContactId());
\ No newline at end of file
diff --git a/entity/CommRestriction_Entity/entityfields/medium/displayValueProcess.js b/entity/CommRestriction_Entity/entityfields/medium/displayValueProcess.js
index 03e760651ba..586a87a7abf 100644
--- a/entity/CommRestriction_Entity/entityfields/medium/displayValueProcess.js
+++ b/entity/CommRestriction_Entity/entityfields/medium/displayValueProcess.js
@@ -3,4 +3,4 @@ import("system.vars");
 import("Keyword_lib");
 import("KeywordRegistry_basic");
 
-result.string(KeywordUtils.getViewValue($KeywordRegistry.commRestriction(), vars.get("$field.MEDIUM")));
\ No newline at end of file
+result.string(KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), vars.get("$field.MEDIUM")));
\ No newline at end of file
diff --git a/entity/CommRestriction_Entity/entityfields/startdate/valueProcess.js b/entity/CommRestriction_Entity/entityfields/startdate/valueProcess.js
new file mode 100644
index 00000000000..3e186c747bf
--- /dev/null
+++ b/entity/CommRestriction_Entity/entityfields/startdate/valueProcess.js
@@ -0,0 +1,7 @@
+import("system.datetime");
+import("system.vars");
+import("system.result");
+import("system.neon");
+
+if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.getString("$this.value"))
+    result.string(datetime.date());
\ No newline at end of file
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index b7d3d1d1d09..d38cda751c9 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -3672,6 +3672,12 @@
     <entry>
       <key>Complaint</key>
     </entry>
+    <entry>
+      <key>Employee responsible</key>
+    </entry>
+    <entry>
+      <key>Restrictions</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 05262fcd5c0..80dbade4aed 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -30,6 +30,10 @@
       <key>Do you really want to delete this recurring appointment?</key>
       <value>Wollen Sie wirklich die Serie löschen?</value>
     </entry>
+    <entry>
+      <key>Advertising bans</key>
+      <value>Werbesperren</value>
+    </entry>
     <entry>
       <key>Add to Campaign</key>
       <value>Zu Kampagne hinzufügen</value>
@@ -42,6 +46,10 @@
       <key>Complaint</key>
       <value>Reklamation</value>
     </entry>
+    <entry>
+      <key>Advertising ban</key>
+      <value>Werbesperre</value>
+    </entry>
     <entry>
       <key>${SQL_LIB_FIELD_WRONG_FORMAT} field: %0</key>
       <value>Das Feld %0 hat ein falsches Format. Das Datenbankfeld muss wie "tablename.columnname" ("ORGANISATION.NAME") oder als Array mit Column-alias formatiert sein: ["ORGANISATION", "NAME", "myorgAlias"]</value>
@@ -4401,10 +4409,6 @@
     <entry>
       <key>Delete</key>
     </entry>
-    <entry>
-      <key>Employee responsible</key>
-      <value>Verantwortlicher Mitarbeiter</value>
-    </entry>
     <entry>
       <key>Street</key>
     </entry>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index 3f538660df5..b9132555169 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -3721,6 +3721,12 @@
     <entry>
       <key>Complaint</key>
     </entry>
+    <entry>
+      <key>Employee responsible</key>
+    </entry>
+    <entry>
+      <key>Restrictions</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/neonContext/CommRestriction/CommRestriction.aod b/neonContext/CommRestriction/CommRestriction.aod
index 9567a9cae1f..4b27ac29d86 100644
--- a/neonContext/CommRestriction/CommRestriction.aod
+++ b/neonContext/CommRestriction/CommRestriction.aod
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0">
   <name>CommRestriction</name>
-  <title>Communication Restriction</title>
+  <title>Advertising ban</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <filterview>CommRestrictionFilter_view</filterview>
   <editview>CommRestrictionSmallEdit_view</editview>
diff --git a/neonView/CommRestrictionFilter_view/CommRestrictionFilter_view.aod b/neonView/CommRestrictionFilter_view/CommRestrictionFilter_view.aod
index ea726694e95..68209b62ffb 100644
--- a/neonView/CommRestrictionFilter_view/CommRestrictionFilter_view.aod
+++ b/neonView/CommRestrictionFilter_view/CommRestrictionFilter_view.aod
@@ -2,6 +2,7 @@
 <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.1">
   <name>CommRestrictionFilter_view</name>
   <title>Restrictions</title>
+  <description>Restrictions</description>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <filterable v="true" />
   <layout>
@@ -13,6 +14,7 @@
     <tableViewTemplate>
       <name>CommRestrictions</name>
       <entityField>#ENTITY</entityField>
+      <title>Restrictions</title>
       <columns>
         <neonTableColumn>
           <name>f3d79ce8-2518-4515-9d9d-6642b763a045</name>
-- 
GitLab