From 9ebc0596c2b65024ddbaf997e2c569dd164929fa Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Fri, 6 Dec 2019 14:54:19 +0100
Subject: [PATCH] DSGVO: added control field to overwrite the settings for alle
 records of a contact # Conflicts: #
 entity/DSGVO_entity/recordcontainers/jdito/onUpdate.js

---
 entity/DSGVO_entity/DSGVO_entity.aod          |  6 ++++
 .../stateProcess.js                           | 12 +++++++
 .../recordcontainers/jdito/onUpdate.js        | 35 +++++++++----------
 .../_____LANGUAGE_EXTRA.aod                   |  9 +++++
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     | 10 ++++++
 .../_____LANGUAGE_en/_____LANGUAGE_en.aod     |  9 +++++
 neonView/DSGVOEdit_view/DSGVOEdit_view.aod    |  4 +++
 .../DSGVOPreview_view/DSGVOPreview_view.aod   |  4 +++
 8 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 entity/DSGVO_entity/entityfields/apply_change_for_all_control/stateProcess.js

diff --git a/entity/DSGVO_entity/DSGVO_entity.aod b/entity/DSGVO_entity/DSGVO_entity.aod
index 2e2c581bff7..41feea5fa80 100644
--- a/entity/DSGVO_entity/DSGVO_entity.aod
+++ b/entity/DSGVO_entity/DSGVO_entity.aod
@@ -196,6 +196,12 @@
     <entityProvider>
       <name>DSGVOEntries</name>
     </entityProvider>
+    <entityField>
+      <name>APPLY_CHANGE_FOR_ALL_CONTROL</name>
+      <title>Apply changes for all</title>
+      <contentType>BOOLEAN</contentType>
+      <stateProcess>%aditoprj%/entity/DSGVO_entity/entityfields/apply_change_for_all_control/stateProcess.js</stateProcess>
+    </entityField>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
diff --git a/entity/DSGVO_entity/entityfields/apply_change_for_all_control/stateProcess.js b/entity/DSGVO_entity/entityfields/apply_change_for_all_control/stateProcess.js
new file mode 100644
index 00000000000..945550f65b9
--- /dev/null
+++ b/entity/DSGVO_entity/entityfields/apply_change_for_all_control/stateProcess.js
@@ -0,0 +1,12 @@
+import("system.neon");
+import("system.result");
+import("system.vars");
+
+var recordState = vars.get("$sys.recordstate");
+var fieldState;
+if (recordState == neon.OPERATINGSTATE_NEW || recordState == neon.OPERATINGSTATE_EDIT)
+    fieldState = neon.COMPONENTSTATE_EDITABLE;
+else
+    fieldState = neon.COMPONENTSTATE_INVISIBLE;
+
+result.string(fieldState);
\ No newline at end of file
diff --git a/entity/DSGVO_entity/recordcontainers/jdito/onUpdate.js b/entity/DSGVO_entity/recordcontainers/jdito/onUpdate.js
index 1199b126de4..5197563de59 100644
--- a/entity/DSGVO_entity/recordcontainers/jdito/onUpdate.js
+++ b/entity/DSGVO_entity/recordcontainers/jdito/onUpdate.js
@@ -1,31 +1,28 @@
+import("system.neon");
 import("system.db");
 import("Sql_lib");
 import("system.vars");
 
 var columns = [
-    "CONTACT_ID",
-    "DATE_NEW",
-    "DATE_EDIT",
-    "PURPOSE",
-    "ROW_ID",
     "STATUORITYSOURCE",
-    "DSGVOTYPE",
-    "USER_NEW",
-    "USER_EDIT",
-    "VALID_TO"
+    "PURPOSE",
+    "VALID_TO",
+    "DATE_EDIT",
+    "USER_EDIT"
 ];
 var values = [
-    vars.get("$field.CONTACT_ID"),
-    vars.get("$field.DATE_NEW"),
-    vars.get("$field.DATE_EDIT"),
-    vars.get("$field.PURPOSE"),
-    vars.get("$field.ROW_ID"),
     vars.get("$field.STATUORITYSOURCE"),
-    vars.get("$field.DSGVOTYPE"),
-    vars.get("$field.USER_NEW"),
+    vars.get("$field.PURPOSE"),
+    vars.get("$field.VALID_TO"),
+    vars.get("$field.DATE_EDIT"),
     vars.get("$field.USER_EDIT"),
-    vars.get("$field.VALID_TO")
+    
 ];
 
-newWhere("DSGVO.DSGVOID", "$field.UID")
-    .updateData(true, "DSGVO", columns, null, values);
\ No newline at end of file
+var updateCond;
+if (vars.getString("$field.APPLY_CHANGE_FOR_ALL_CONTROL") == "1")
+	updateCond = newWhere("DSGVO.CONTACT_ID", "$field.CONTACT_ID")
+else
+	updateCond = newWhere("DSGVO.DSGVOID", "$field.UID")
+
+updateCond.updateData(true, "DSGVO", columns, null, values);
\ No newline at end of file
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index 89e762c3f80..2cd57121f29 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -5942,6 +5942,15 @@
     <entry>
       <key>New Appointment</key>
     </entry>
+    <entry>
+      <key>Custom template</key>
+    </entry>
+    <entry>
+      <key>Apply changes for all</key>
+    </entry>
+    <entry>
+      <key>grandchild of</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 676938d62cc..5735f5b56d3 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -7462,6 +7462,16 @@
       <key>New Appointment</key>
       <value>Neuer Termin</value>
     </entry>
+    <entry>
+      <key>ankle of</key>
+    </entry>
+    <entry>
+      <key>Apply changes for all</key>
+      <value>Änderungen für alle übernehmen</value>
+    </entry>
+    <entry>
+      <key>series delete action</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index ceff15d2d87..55a1d2e0bc4 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -5992,6 +5992,15 @@
     <entry>
       <key>New Appointment</key>
     </entry>
+    <entry>
+      <key>Custom template</key>
+    </entry>
+    <entry>
+      <key>Apply changes for all</key>
+    </entry>
+    <entry>
+      <key>grandchild of</key>
+    </entry>
   </keyValueMap>
   <font name="Dialog" style="0" size="11" />
 </language>
diff --git a/neonView/DSGVOEdit_view/DSGVOEdit_view.aod b/neonView/DSGVOEdit_view/DSGVOEdit_view.aod
index 959a8669bba..0e2ff31bac7 100644
--- a/neonView/DSGVOEdit_view/DSGVOEdit_view.aod
+++ b/neonView/DSGVOEdit_view/DSGVOEdit_view.aod
@@ -30,6 +30,10 @@
           <name>a9e1245c-7798-4170-9f2f-2e33f61cd6aa</name>
           <entityField>VALID_TO</entityField>
         </entityFieldLink>
+        <entityFieldLink>
+          <name>605ab093-46de-4da2-a155-c86b02206553</name>
+          <entityField>APPLY_CHANGE_FOR_ALL_CONTROL</entityField>
+        </entityFieldLink>
       </fields>
     </genericViewTemplate>
   </children>
diff --git a/neonView/DSGVOPreview_view/DSGVOPreview_view.aod b/neonView/DSGVOPreview_view/DSGVOPreview_view.aod
index 6e5f44147b3..774029e9aae 100644
--- a/neonView/DSGVOPreview_view/DSGVOPreview_view.aod
+++ b/neonView/DSGVOPreview_view/DSGVOPreview_view.aod
@@ -34,6 +34,10 @@
           <name>db62ba6a-91e9-42e3-a95c-7259c237c290</name>
           <entityField>VALID_TO</entityField>
         </entityFieldLink>
+        <entityFieldLink>
+          <name>6cd8795a-9779-4a7d-9aaf-7da580424742</name>
+          <entityField>APPLY_CHANGE_FOR_ALL_CONTROL</entityField>
+        </entityFieldLink>
       </fields>
     </genericViewTemplate>
   </children>
-- 
GitLab