From 1d887371dcc638c4cc9442a1f2abfd1020204fc8 Mon Sep 17 00:00:00 2001
From: "a.schindlbeck" <a.schindlbeck@adito.de>
Date: Tue, 11 Jun 2019 16:16:46 +0200
Subject: [PATCH] =?UTF-8?q?Kalender:=20Serientermine=20gesamt=20l=C3=B6sch?=
 =?UTF-8?q?en?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Appointment_entity/Appointment_entity.aod | 26 ++++++++++---------
 .../deleteseries/onActionProcess.js           |  0
 .../entityfields/deleteseries/stateProcess.js | 16 ++++++++++++
 .../children/accept/stateProcess.js           |  9 +++++++
 .../children/decline/stateProcess.js          |  9 +++++++
 .../children/tentative/stateProcess.js        |  9 +++++++
 .../_____LANGUAGE_de/_____LANGUAGE_de.aod     |  4 +++
 7 files changed, 61 insertions(+), 12 deletions(-)
 rename entity/Appointment_entity/entityfields/{seriesactiongroup/children => }/deleteseries/onActionProcess.js (100%)
 create mode 100644 entity/Appointment_entity/entityfields/deleteseries/stateProcess.js
 create mode 100644 entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/stateProcess.js
 create mode 100644 entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/stateProcess.js
 create mode 100644 entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/stateProcess.js

diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod
index 8fbeb7bf39..156c683d4c 100644
--- a/entity/Appointment_entity/Appointment_entity.aod
+++ b/entity/Appointment_entity/Appointment_entity.aod
@@ -79,20 +79,26 @@
           <title>accept</title>
           <onActionProcess>%aditoprj%/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js</onActionProcess>
           <actionOrder v="0" />
+          <isMenuAction v="true" />
           <iconId>VAADIN:CHECK</iconId>
+          <stateProcess>%aditoprj%/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/stateProcess.js</stateProcess>
         </entityActionField>
         <entityActionField>
           <name>decline</name>
           <title>decline</title>
           <description></description>
           <onActionProcess>%aditoprj%/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/onActionProcess.js</onActionProcess>
+          <isMenuAction v="true" />
           <iconId>VAADIN:CLOSE</iconId>
+          <stateProcess>%aditoprj%/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/stateProcess.js</stateProcess>
         </entityActionField>
         <entityActionField>
           <name>tentative</name>
           <title>tentative</title>
           <onActionProcess>%aditoprj%/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/onActionProcess.js</onActionProcess>
+          <isMenuAction v="true" />
           <iconId>VAADIN:QUESTION</iconId>
+          <stateProcess>%aditoprj%/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/stateProcess.js</stateProcess>
         </entityActionField>
       </children>
     </entityActionGroup>
@@ -162,18 +168,14 @@
         </entityParameter>
       </children>
     </entityConsumer>
-    <entityActionGroup>
-      <name>seriesActionGroup</name>
-      <children>
-        <entityActionField>
-          <name>deleteSeries</name>
-          <title>Delete</title>
-          <onActionProcess>%aditoprj%/entity/Appointment_entity/entityfields/seriesactiongroup/children/deleteseries/onActionProcess.js</onActionProcess>
-          <iconId>VAADIN:TRASH</iconId>
-          <tooltip>series delete action</tooltip>
-        </entityActionField>
-      </children>
-    </entityActionGroup>
+    <entityActionField>
+      <name>deleteSeries</name>
+      <title>Delete recurring appointment</title>
+      <onActionProcess>%aditoprj%/entity/Appointment_entity/entityfields/deleteseries/onActionProcess.js</onActionProcess>
+      <iconId>VAADIN:TRASH</iconId>
+      <stateProcess>%aditoprj%/entity/Appointment_entity/entityfields/deleteseries/stateProcess.js</stateProcess>
+      <tooltip>series delete action</tooltip>
+    </entityActionField>
   </entityFields>
   <recordContainers>
     <jDitoRecordContainer>
diff --git a/entity/Appointment_entity/entityfields/seriesactiongroup/children/deleteseries/onActionProcess.js b/entity/Appointment_entity/entityfields/deleteseries/onActionProcess.js
similarity index 100%
rename from entity/Appointment_entity/entityfields/seriesactiongroup/children/deleteseries/onActionProcess.js
rename to entity/Appointment_entity/entityfields/deleteseries/onActionProcess.js
diff --git a/entity/Appointment_entity/entityfields/deleteseries/stateProcess.js b/entity/Appointment_entity/entityfields/deleteseries/stateProcess.js
new file mode 100644
index 0000000000..8d6b8cb3ec
--- /dev/null
+++ b/entity/Appointment_entity/entityfields/deleteseries/stateProcess.js
@@ -0,0 +1,16 @@
+import("system.tools");
+import("system.logging");
+import("system.vars");
+import("system.result");
+import("system.calendars");
+import("system.neon");
+
+
+var event = JSON.parse(vars.getString("$param.Entry_param"));
+
+if(event != undefined && event != "") //event not empty
+    if(event[calendars.RECURRENCEID] != undefined && event[calendars.RECURRENCEID] != "") //event recurring appointment
+        if(event[calendars.ORGANIZER] == tools.getCurrentUser()["title"]) //user == organizer
+            result.object(neon.COMPONENTSTATE_EDITABLE);
+        else
+            result.object(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
diff --git a/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/stateProcess.js b/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/stateProcess.js
new file mode 100644
index 0000000000..073b734358
--- /dev/null
+++ b/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/stateProcess.js
@@ -0,0 +1,9 @@
+import("system.calendars");
+import("system.neon");
+import("system.result");
+
+
+if(calendars.getBackendType() == calendars.BACKEND_EXCHANGEWS)
+    result.object(neon.COMPONENTSTATE_EDITABLE);
+else
+    result.object(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
diff --git a/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/stateProcess.js b/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/stateProcess.js
new file mode 100644
index 0000000000..073b734358
--- /dev/null
+++ b/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/stateProcess.js
@@ -0,0 +1,9 @@
+import("system.calendars");
+import("system.neon");
+import("system.result");
+
+
+if(calendars.getBackendType() == calendars.BACKEND_EXCHANGEWS)
+    result.object(neon.COMPONENTSTATE_EDITABLE);
+else
+    result.object(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
diff --git a/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/stateProcess.js b/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/stateProcess.js
new file mode 100644
index 0000000000..073b734358
--- /dev/null
+++ b/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/stateProcess.js
@@ -0,0 +1,9 @@
+import("system.calendars");
+import("system.neon");
+import("system.result");
+
+
+if(calendars.getBackendType() == calendars.BACKEND_EXCHANGEWS)
+    result.object(neon.COMPONENTSTATE_EDITABLE);
+else
+    result.object(neon.COMPONENTSTATE_INVISIBLE);
\ No newline at end of file
diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
index 8dfda32655..a28be4d1a1 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -98,6 +98,10 @@
       <key>Confirm password</key>
       <value>Passwort prüfen</value>
     </entry>
+    <entry>
+      <key>Delete recurring appointment</key>
+      <value>Serie löschen</value>
+    </entry>
     <entry>
       <key>Human Resources</key>
       <value>Personal</value>
-- 
GitLab