Commit 2fb76d3a authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-983 Allow MAPIProvider->setAppointment() to ignore start+endtime if

they are not set.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 28211363
......@@ -1185,19 +1185,6 @@ class MAPIProvider {
else
$tz = false;
//calculate duration because without it some webaccess views are broken. duration is in min
$localstart = $this->getLocaltimeByTZ($appointment->starttime, $tz);
$localend = $this->getLocaltimeByTZ($appointment->endtime, $tz);
$duration = ($localend - $localstart)/60;
//nokia sends an yearly event with 0 mins duration but as all day event,
//so make it end next day
if ($appointment->starttime == $appointment->endtime && isset($appointment->alldayevent) && $appointment->alldayevent) {
$duration = 1440;
$appointment->endtime = $appointment->starttime + 24 * 60 * 60;
$localend = $localstart + 24 * 60 * 60;
}
// is the transmitted UID OL compatible?
// if not, encapsulate the transmitted uid
$appointment->uid = Utils::GetOLUidFromICalUid($appointment->uid);
......@@ -1218,12 +1205,28 @@ class MAPIProvider {
$private = (isset($appointment->sensitivity) && $appointment->sensitivity >= SENSITIVITY_PRIVATE) ? true : false;
// Set commonstart/commonend to start/end and remindertime to start, duration, private and cleanGlobalObjectId
if ($appointment->starttime && $appointment->endtime) {
$props[$appointmentprops["commonstart"]] = $appointment->starttime;
$props[$appointmentprops["commonend"]] = $appointment->endtime;
//calculate duration because without it some webaccess views are broken. duration is in min
$localstart = $this->getLocaltimeByTZ($appointment->starttime, $tz);
$localend = $this->getLocaltimeByTZ($appointment->endtime, $tz);
$duration = ($localend - $localstart)/60;
//nokia sends an yearly event with 0 mins duration but as all day event,
//so make it end next day
if ($appointment->starttime == $appointment->endtime && isset($appointment->alldayevent) && $appointment->alldayevent) {
$duration = 1440;
$appointment->endtime = $appointment->starttime + 24 * 60 * 60;
$localend = $localstart + 24 * 60 * 60;
}
$props[$appointmentprops["duration"]] = $duration;
}
$props[$appointmentprops["reminderstart"]] = $appointment->starttime;
// Set reminder boolean to 'true' if reminder is set
$props[$appointmentprops["reminderset"]] = isset($appointment->reminder) ? true : false;
$props[$appointmentprops["duration"]] = $duration;
$props[$appointmentprops["private"]] = $private;
$props[$appointmentprops["uid"]] = $appointment->uid;
// Set named prop 8510, unknown property, but enables deleting a single occurrence of a recurring
......@@ -1259,6 +1262,10 @@ class MAPIProvider {
// set the recurrence type to that of the MAPI
$props[$appointmentprops["recurrencetype"]] = $recur["recurrencetype"];
if (!isset($localstart) || !isset($localend)) {
throw new StatusException("MAPIProvider->setAppointment(): Error, recurring appointment needs a start and end time to be saved.", SYNC_STATUS_SYNCCANNOTBECOMPLETED);
}
$starttime = $this->gmtime($localstart);
$endtime = $this->gmtime($localend);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment