From 3c0d18fdbc961b7aa723e2e937558d9fa8146e26 Mon Sep 17 00:00:00 2001
From: "a.schindlbeck" <a.schindlbeck@adito.de>
Date: Mon, 15 Oct 2018 14:17:53 +0200
Subject: [PATCH] =?UTF-8?q?Termin:=20privat,=20ganzt=C3=A4gig,=20transpare?=
 =?UTF-8?q?nt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Appointment_entity/Appointment_entity.aod   | 10 ++++++----
 entity/Appointment_entity/contentProcess.js     |  4 ++--
 .../entityfields/allday/valueProcess.js         | 17 +++++++++++++++++
 entity/Appointment_entity/onUpdate.js           | 12 +-----------
 .../AppointmentEdit_view.aod                    |  2 +-
 .../_____PREFERENCES_PROJECT.aod                |  2 +-
 6 files changed, 28 insertions(+), 19 deletions(-)
 create mode 100644 entity/Appointment_entity/entityfields/allday/valueProcess.js

diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod
index ee9c00ae7fe..17f38943a25 100644
--- a/entity/Appointment_entity/Appointment_entity.aod
+++ b/entity/Appointment_entity/Appointment_entity.aod
@@ -21,7 +21,7 @@
     <element>LOCATION</element>
     <element>ICON</element>
     <element>CLASSIFICATION</element>
-    <element>ALLDAY</element>
+    <element>TRANSPARENCY</element>
   </fields>
   <contentProcess>%aditoprj%/entity/Appointment_entity/contentProcess.js</contentProcess>
   <onInsert>%aditoprj%/entity/Appointment_entity/onInsert.js</onInsert>
@@ -97,11 +97,13 @@
       <fieldName>ATTENDEES</fieldName>
       <possibleItemsProcess>%aditoprj%/entity/Appointment_entity/entityfields/attendees/possibleItemsProcess.js</possibleItemsProcess>
     </entityField>
+    <entityField>
+      <name>TRANSPARENCY</name>
+      <fieldName>TRANSPARENCY</fieldName>
+    </entityField>
     <entityField>
       <name>ALLDAY</name>
-      <fieldName>ALLDAY</fieldName>
-      <contentType>BOOLEAN</contentType>
-      <selectionMode>NONE</selectionMode>
+      <valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/allday/valueProcess.js</valueProcess>
     </entityField>
   </entityFields>
 </entity>
diff --git a/entity/Appointment_entity/contentProcess.js b/entity/Appointment_entity/contentProcess.js
index 6a57154016b..f4b3c559834 100644
--- a/entity/Appointment_entity/contentProcess.js
+++ b/entity/Appointment_entity/contentProcess.js
@@ -23,12 +23,12 @@ if(vars.exists("$param.entry"))
     var reminder = entry[calendars.REMINDER];
     var remindercheck = entry[calendars.HASREMINDER]
     var classification = entry[calendars.CLASSIFICATION];
-    var allday = entry[calendars];
+    var transparency = entry[calendars.TRANSPARENCY];
     
     //@TODO Icon 
   
     result.object([
-        [uid, '', '', attendees.length, startdate, enddate, summary, organizer, attendees, status, links, description, location, '', classification, allday] //, location, reminder, remindercheck
+        [uid, '', '', attendees.length, startdate, enddate, summary, organizer, attendees, status, links, description, location, '', classification, transparency] //reminder, remindercheck
         ]);
 }
 else
diff --git a/entity/Appointment_entity/entityfields/allday/valueProcess.js b/entity/Appointment_entity/entityfields/allday/valueProcess.js
new file mode 100644
index 00000000000..aab21974bdd
--- /dev/null
+++ b/entity/Appointment_entity/entityfields/allday/valueProcess.js
@@ -0,0 +1,17 @@
+import("system.vars");
+import("system.datetime");
+import("system.result");
+
+var start = vars.get("$field.BEGIN");
+var end = vars.get("$fild.END")
+
+var startNumber = number(start);
+var endNumber = number(end);
+
+// überprüft ob beide uhrzeiten start und end auf 0 Uhr stehen und
+// ob es 0 Uhr des selben tages ist
+var isAllday = datetime.toDate(start, "HH:mm") == "00:00" && 
+    datetime.toDate(end, "HH:mm") == "23:59" && 
+    startNumber < endNumber;
+
+result.string(allday);
\ No newline at end of file
diff --git a/entity/Appointment_entity/onUpdate.js b/entity/Appointment_entity/onUpdate.js
index 9418f7f109e..c57e7291d14 100644
--- a/entity/Appointment_entity/onUpdate.js
+++ b/entity/Appointment_entity/onUpdate.js
@@ -64,7 +64,7 @@ if(vars.exists("param.entry"))
         //            }
         //        }
         }
-        //    event[calendars.TRANSPARENCY] = vars.get("$comp.transparency");  
+        event[calendars.TRANSPARENCY] = vars.get("$field.TRANSPARENCY");  
             //event[calendars.AFFECTEDUSERS] = getAffectedUsers( event ); 
         //    calcrecurrence(event);
         //    if (event[calendars.RRULE] != undefined)     recurrencend(event);
@@ -76,16 +76,6 @@ if(vars.exists("param.entry"))
          
         ok = true;
     }
-    //    //Zwischenspeichern
-    //    if(vars.exists("$image.dontClose") && vars.get("$image.dontClose") )    ok = false; //Maske offen lassen
-    //    vars.set("$image.dontClose",  false); // zurücksetzen, damit Klick auf Speichern noch funktioniert
-
-    
-   if(vars.exists("$sys.ancestorimageuid") && vars.get("$sys.ancestorimageuid") != null)
-    {
-        neon.closeImage(vars.getString("$sys.currentimage"), true);
-        neon.refresh(vars.get("$sys.ancestorimageuid"));
-    }
 }
 // Liefert die AffectedUsers
 function getAffectedUsers( pEvent )
diff --git a/neonView/AppointmentEdit_view/AppointmentEdit_view.aod b/neonView/AppointmentEdit_view/AppointmentEdit_view.aod
index 525b48c9d93..8f048270ea1 100644
--- a/neonView/AppointmentEdit_view/AppointmentEdit_view.aod
+++ b/neonView/AppointmentEdit_view/AppointmentEdit_view.aod
@@ -14,13 +14,13 @@
       <descriptionField>DESCRIPTION</descriptionField>
       <beginField>BEGIN</beginField>
       <endField>END</endField>
-      <affectedUsersField>ATTENDEES</affectedUsersField>
       <attendeesField>ATTENDEES</attendeesField>
       <privateField>CLASSIFICATION</privateField>
       <statusField>STATUS</statusField>
       <locationField>LOCATION</locationField>
       <categoriesField>CATEGORIES</categoriesField>
       <alldayField>ALLDAY</alldayField>
+      <transparencyField>TRANSPARENCY</transparencyField>
       <entityField>#ENTITY</entityField>
     </appointmentEditViewTemplate>
   </children>
diff --git a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod
index b0f2142f631..9fb33b2728f 100644
--- a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod
+++ b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod
@@ -2,7 +2,7 @@
 <preferences xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="3.0.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/preferences/3.0.1">
   <name>_____PREFERENCES_PROJECT</name>
   <majorModelMode>DISTRIBUTED</majorModelMode>
-  <projectName>xRM-Basic-5</projectName>
+  <projectName>xRM-Basic 5</projectName>
   <jditoMaxContentSize v="57671680" />
   <calendarCategoriesEvent>
     <entry>
-- 
GitLab