Skip to content

Commit

Permalink
Simplify.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Dec 17, 2018
1 parent f8936b4 commit 820fbab
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -1573,13 +1573,15 @@ public function fromASAppointment(Horde_ActiveSync_Message_Appointment $message)

$erules = $message->getExceptions();
foreach ($erules as $rule){
/* Readd the exception event, but only if not deleted */
/* Add exception to recurrence obj*/
$original = $rule->getExceptionStartTime();
$original->setTimezone($tz);
$this->recurrence->addException($original->format('Y'), $original->format('m'), $original->format('d'));

/* Readd the exception event, if not deleted */
if (!$rule->deleted) {
$event = $kronolith_driver->getEvent();
$times = $rule->getDatetime();
$original = $rule->getExceptionStartTime();
$original->setTimezone($tz);
$this->recurrence->addException($original->format('Y'), $original->format('m'), $original->format('d'));
$event->start = $times['start'];
$event->end = $times['end'];
$event->start->setTimezone($tz);
Expand All @@ -1596,12 +1598,7 @@ public function fromASAppointment(Horde_ActiveSync_Message_Appointment $message)
$event->timezone = $tz;
}
$event->save();
} else {
/* For exceptions that are deletions, just add the exception */
$exceptiondt = $rule->getExceptionStartTime();
$exceptiondt->setTimezone($tz);
$this->recurrence->addException($exceptiondt->format('Y'), $exceptiondt->format('m'), $exceptiondt->format('d'));
}
}
}
}

Expand Down

0 comments on commit 820fbab

Please sign in to comment.