From: Michael J. Rubinsky Date: Thu, 10 Sep 2009 16:12:20 +0000 (-0400) Subject: Only attempt to remove resources from the event if they have actually X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=cf362090da5b6c4117157e38de1a365317704e58;p=horde.git Only attempt to remove resources from the event if they have actually accepted the event. --- diff --git a/kronolith/lib/Driver/Sql.php b/kronolith/lib/Driver/Sql.php index 37741c606..8c9e4b205 100644 --- a/kronolith/lib/Driver/Sql.php +++ b/kronolith/lib/Driver/Sql.php @@ -739,9 +739,11 @@ class Kronolith_Driver_Sql extends Kronolith_Driver $resources = $event->getResources(); if (count($resources)) { $rd = Kronolith::getDriver('Resource'); - foreach (array_keys($resources) as $uid) { - $r = $rd->getResource($uid); - $r->removeEvent($event); + foreach ($resources as $uid => $resource) { + if ($resource['response'] !== Kronolith::RESPONSE_DECLINED) { + $r = $rd->getResource($uid); + $r->removeEvent($event); + } } } diff --git a/kronolith/lib/Resource/Single.php b/kronolith/lib/Resource/Single.php index 25a89dcf8..d0a15fbd7 100644 --- a/kronolith/lib/Resource/Single.php +++ b/kronolith/lib/Resource/Single.php @@ -44,8 +44,6 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base if (!($e->start->compareDateTime($event->end) >= 1 || $e->end->compareDateTime($event->start) <= -1)) { - // $e starts after $event ends OR $e ends before $event->start - return false; } } @@ -95,11 +93,11 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base { $driver = Kronolith::getDriver('Resource', $this->calendar); $re = $driver->getByUID($event->getUID(), array($this->calendar)); - if ($re instanceof PEAR_Error) { - throw new Horde_Exception ($re->getMessage()); + // Event will only be in the calendar if it's been accepted. This error + // should never happen, but put it here as a safeguard for now. + if (!($re instanceof PEAR_Error)) { + $driver->deleteEvent($re->getId()); } - - $driver->deleteEvent($re->getId()); } /** @@ -124,4 +122,5 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base throw new Horde_Exception(_("Resource already exists. Cannot change the id.")); } } + } \ No newline at end of file