From 0febc14a63496a8b38d17f59b791575d0a0536e5 Mon Sep 17 00:00:00 2001
From: "a.schindlbeck" <a.schindlbeck@adito.de>
Date: Tue, 6 Nov 2018 09:12:26 +0100
Subject: [PATCH] Zwischenstand Appointments

---
 .../Appointment_entity/Appointment_entity.aod |  7 +++--
 entity/Appointment_entity/contentProcess.js   |  2 +-
 entity/Appointment_entity/onUpdate.js         | 27 ++++---------------
 .../AppointmentEdit_view.aod                  |  1 +
 4 files changed, 10 insertions(+), 27 deletions(-)

diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod
index d18c57457b..769ec9f9a5 100644
--- a/entity/Appointment_entity/Appointment_entity.aod
+++ b/entity/Appointment_entity/Appointment_entity.aod
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.3" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.0.3">
+<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.4" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.0.4">
   <name>Appointment_entity</name>
   <title>Termin</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
@@ -23,6 +23,7 @@
     <element>CLASSIFICATION</element>
     <element>TRANSPARENCY</element>
     <element>CATEGORIES</element>
+    <element>REMINDER</element>
     <element>RRULE</element>
     <element>RECURRENCEID</element>
     <element>SAFESCOPEFIELD</element>
@@ -91,6 +92,7 @@
     </entityField>
     <entityField>
       <name>REMINDER</name>
+      <fieldName>REMINDER</fieldName>
     </entityField>
     <entityField>
       <name>CATEGORIES</name>
@@ -117,7 +119,6 @@
           <onActionProcess>%aditoprj%/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js</onActionProcess>
           <actionOrder v="0" />
           <caption>zusagen</caption>
-          <icon>VAADIN:CHECK</icon>
           <iconId>VAADIN:CHECK</iconId>
         </entityActionField>
         <entityActionField>
@@ -126,7 +127,6 @@
           <description></description>
           <onActionProcess>%aditoprj%/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/onActionProcess.js</onActionProcess>
           <caption>absagen</caption>
-          <icon>VAADIN:CLOSE</icon>
           <iconId>VAADIN:CLOSE</iconId>
         </entityActionField>
         <entityActionField>
@@ -134,7 +134,6 @@
           <fieldType>ACTION</fieldType>
           <onActionProcess>%aditoprj%/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/onActionProcess.js</onActionProcess>
           <caption>vielleicht</caption>
-          <icon>VAADIN:QUESTION</icon>
           <iconId>VAADIN:QUESTION</iconId>
         </entityActionField>
       </children>
diff --git a/entity/Appointment_entity/contentProcess.js b/entity/Appointment_entity/contentProcess.js
index 4554846ac4..7b83997ecf 100644
--- a/entity/Appointment_entity/contentProcess.js
+++ b/entity/Appointment_entity/contentProcess.js
@@ -49,7 +49,7 @@ if(vars.exists("$param.entry"))
     result.object([
         [uid, '', '', attendees.length, startdate, enddate, summary, organizer,
             attendees, status, links, description, location, '', classification,
-            transparency, categories, rrule, recurrenceID, null, masterBegin, masterEnd] //reminder, remindercheck
+            transparency, categories, reminder, rrule, recurrenceID, null, masterBegin, masterEnd] //reminder, remindercheck
     ]);
 }
 else
diff --git a/entity/Appointment_entity/onUpdate.js b/entity/Appointment_entity/onUpdate.js
index 48860685ef..e455951350 100644
--- a/entity/Appointment_entity/onUpdate.js
+++ b/entity/Appointment_entity/onUpdate.js
@@ -38,35 +38,18 @@ if(vars.exists("$param.entry"))
         event[calendars.CATEGORIES] = vars.get("$field.CATEGORIES");
         event[calendars.AFFECTEDUSERS] = vars.get("$field.ATTENDEES");
         event[calendars.TRANSPARENCY] = vars.get("$field.TRANSPARENCY");
-        var hasReminder = vars.get("$field.REMINDER_CHECK");
-        if (hasReminder == "true")
+        if (vars.get("$field.REMINDER") != undefined && vars.get("$field.REMINDER") != "")
         {
-            // Absolut nur, wenn auch gesetzt. Default ist relativ
-            if ( event[calendars.REMINDER_ABSOLUT] == "true")
-            {
-                var reminder_date = vars.get("$field.REMINDER");
-                if ( reminder_date != "" )
-                {
-                    event[calendars.HASREMINDER] = "true";
-                    event[calendars.REMINDER_DATE] = reminder_date;
-                }
-            }
-        //        else
-        //        {
-        //            var reminder_duration = vars.getString("$comp.reminder_duration");
-        //            if ( reminder_duration != "")
-        //            {
-        //                event[calendars.HASREMINDER] = "true";
-        //                event[calendars.REMINDER_DURATION] = reminder_duration;
-        //            }
-        //        }
+            event[calendars.HASREMINDER] = "true";
+            event[calendars.REMINDER] = vars.get("$field.REMINDER");
+        }
             //event[calendars.AFFECTEDUSERS] = getAffectedUsers( event ); 
         //    calcrecurrence(event);
         //    if (event[calendars.RRULE] != undefined)     recurrencend(event);
         // Links updaten
         //swing.saveTableEdit("$comp.links");
         // Entweder jetzt neu anlegen oder nur updaten
-        }
+        
 
         calendars.updateEntry(event);
          
diff --git a/neonView/AppointmentEdit_view/AppointmentEdit_view.aod b/neonView/AppointmentEdit_view/AppointmentEdit_view.aod
index c945aba0b4..085c85de2a 100644
--- a/neonView/AppointmentEdit_view/AppointmentEdit_view.aod
+++ b/neonView/AppointmentEdit_view/AppointmentEdit_view.aod
@@ -28,6 +28,7 @@
       <saveScopeField>SAFESCOPEFIELD</saveScopeField>
       <masterBeginField>MASTERBEGIN</masterBeginField>
       <masterEndField>MASTEREND</masterEndField>
+      <reminderField>REMINDER</reminderField>
       <entityField>#ENTITY</entityField>
     </appointmentEditViewTemplate>
   </children>
-- 
GitLab