From bbedb7d13a8f23aaa552c93c88e5056267430461 Mon Sep 17 00:00:00 2001
From: "a.schindlbeck" <a.schindlbeck@adito.de>
Date: Fri, 31 Jul 2020 16:57:50 +0200
Subject: [PATCH] #1062785 Calendar: Bugfixes recurring appointments

---
 .../Appointment_entity/Appointment_entity.aod |  1 +
 .../entityfields/begin/valueProcess.js        | 10 ++---
 .../entityfields/end/valueProcess.js          | 10 ++---
 .../recordcontainers/jdito/contentProcess.js  | 37 ++++++++++---------
 .../AppointmentPreview_view.aod               |  1 +
 5 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod
index 28c70af661..c68158fb33 100644
--- a/entity/Appointment_entity/Appointment_entity.aod
+++ b/entity/Appointment_entity/Appointment_entity.aod
@@ -183,6 +183,7 @@
         <entityParameter>
           <name>AppointmentState_param</name>
           <valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/appointmentlinks/children/appointmentstate_param/valueProcess.js</valueProcess>
+          <expose v="false" />
         </entityParameter>
       </children>
     </entityConsumer>
diff --git a/entity/Appointment_entity/entityfields/begin/valueProcess.js b/entity/Appointment_entity/entityfields/begin/valueProcess.js
index 494b5d528f..87e3ad4739 100644
--- a/entity/Appointment_entity/entityfields/begin/valueProcess.js
+++ b/entity/Appointment_entity/entityfields/begin/valueProcess.js
@@ -19,8 +19,8 @@ if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$para
 /**
  * Sets explicitly the start date when a preset is sent from the core, due to a move or resize event from the user. Do not remove.
  */
-if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && vars.exists("$param.Entry_param"))
-{
-    let event = JSON.parse(vars.getString("$param.Entry_param"));
-    result.string(event[calendars.DTSTART]);
-}
\ No newline at end of file
+//if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && vars.exists("$param.Entry_param"))
+//{
+//    var event = JSON.parse(vars.getString("$param.Entry_param"));
+//    result.string(event[calendars.DTSTART]);
+//}
\ No newline at end of file
diff --git a/entity/Appointment_entity/entityfields/end/valueProcess.js b/entity/Appointment_entity/entityfields/end/valueProcess.js
index 23262e1a86..4f9cd21b8a 100644
--- a/entity/Appointment_entity/entityfields/end/valueProcess.js
+++ b/entity/Appointment_entity/entityfields/end/valueProcess.js
@@ -19,8 +19,8 @@ if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$para
 /**
  * Sets explicitly the end date when a preset is sent from the core, due to a move or resize event from the user. Do not remove.
  */
-if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && vars.exists("$param.Entry_param"))
-{
-    let event = JSON.parse(vars.getString("$param.Entry_param"));
-    result.string(event[calendars.DTEND]);
-}
\ No newline at end of file
+//if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && vars.exists("$param.Entry_param"))
+//{
+//    let event = JSON.parse(vars.getString("$param.Entry_param"));
+//    result.string(event[calendars.DTEND]);
+//}
\ No newline at end of file
diff --git a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js
index 7e8972a145..e56415a0fa 100644
--- a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js
@@ -13,7 +13,25 @@ import("system.neon");
 var appointmentSelect = newSelect("APPOINTMENT_ID").from("AB_APPOINTMENTLINK");
 var appointmentUids;
 
-if(vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW && vars.get("$local.idvalues") != null && vars.get("$local.idvalues") != "")
+/**
+ * Will be used, if the user is operating the calendar.
+ */
+if(vars.exists("$param.Entry_param") && vars.get("$param.Entry_param"))
+{
+    var entry = JSON.parse(vars.getString("$param.Entry_param"));
+
+    var masterEntry = null;
+    if (vars.exists("$param.MasterEntry_param") && vars.get("$param.MasterEntry_param") != "") {
+        masterEntry = JSON.parse(vars.getString("$param.MasterEntry_param"));
+    }
+
+    //@TODO Icon 
+    result.object([
+        buildEntry(entry, masterEntry)
+    ]);
+}
+
+else if(vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW && vars.get("$local.idvalues") != null && vars.get("$local.idvalues") != "")
 {
     var selectedids = vars.get("$local.idvalues");
     result.object([buildEntry(calendars.getEntry(selectedids, null, null), null)]);
@@ -35,23 +53,6 @@ else if(vars.getString("$param.LinkedObjectId_param") != undefined)
     appointmentSelect.whereIfSet("AB_APPOINTMENTLINK.OBJECT_ROWID", "$param.LinkedObjectId_param")
     result.object(buildEntriesFromUids(appointmentSelect.table()));
 }
-/**
- * Will be used, if the user is operating the calendar.
- */
-else if(vars.exists("$param.Entry_param") && vars.get("$param.Entry_param"))
-{
-    var entry = JSON.parse(vars.getString("$param.Entry_param"));
-
-    var masterEntry = null;
-    if (vars.exists("$param.MasterEntry_param") && vars.get("$param.MasterEntry_param") != "") {
-        masterEntry = JSON.parse(vars.getString("$param.MasterEntry_param"));
-    }
-
-    //@TODO Icon 
-    result.object([
-        buildEntry(entry, masterEntry)
-    ]);
-}
 
 function buildEntriesFromUids(appointmentUids)
 {
diff --git a/neonView/AppointmentPreview_view/AppointmentPreview_view.aod b/neonView/AppointmentPreview_view/AppointmentPreview_view.aod
index 23c9de063b..727a644d89 100644
--- a/neonView/AppointmentPreview_view/AppointmentPreview_view.aod
+++ b/neonView/AppointmentPreview_view/AppointmentPreview_view.aod
@@ -27,6 +27,7 @@
       <organizerField>ORGANIZER</organizerField>
       <ownerField>OWNER</ownerField>
       <categoriesField>CATEGORIES</categoriesField>
+      <recurrenceIdField>RECURRENCEID</recurrenceIdField>
       <favoriteActionGroup1>PartStatActionGroup</favoriteActionGroup1>
       <favoriteActionGroup2>seriesActionGroup</favoriteActionGroup2>
       <entityField>#ENTITY</entityField>
-- 
GitLab