6.0.0-alpha12
6/7/25

[#9423] Error in delete API call when exists multiple events with same UID
Summary Error in delete API call when exists multiple events with same UID
Queue Kronolith
Queue Version FRAMEWORK_3
Type Bug
State Resolved
Priority 1. Low
Owners jan (at) horde (dot) org
Requester almarin (at) um (dot) es
Created 12/02/2010 (5301 days ago)
Due
Updated 07/02/2011 (5089 days ago)
Assigned
Resolved 07/02/2011 (5089 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
07/02/2011 05:25:16 PM Jan Schneider Assigned to Jan Schneider
State ⇒ Resolved
 
07/02/2011 05:25:09 PM CVS Commit Comment #3 Reply to this comment
Changes have been made in CVS for this ticket:

MFH: Make sure the calendar is opened that we get the event from (Bug #9423).
http://cvs.horde.org/diff.php/kronolith/lib/api.php?rt=horde&r1=1.126.2.67&r2=1.126.2.68&ty=u
07/02/2011 05:24:19 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git for this ticket:

Make sure the calendar is opened that we get the event from (Bug #9423).

  1 files changed, 1 insertions(+), 0 deletions(-)
http://git.horde.org/horde-git/-/commit/386adb3fc1f14ee260b909db957fcaec1031fa3b
12/02/2010 01:12:50 PM almarin (at) um (dot) es Comment #1
Priority ⇒ 1. Low
Patch ⇒ No
Milestone ⇒
Queue ⇒ Kronolith
Summary ⇒ Error in delete API call when exists multiple events with same UID
Type ⇒ Bug
State ⇒ Unconfirmed
Reply to this comment
In _kronolith_delete($uid) function, it sometimes give an error 
deleting an event which has some copies with the same UID.

After calling getByUID with getAll flag set to true, kronolith_driver 
remain open the last calendar which have a copy of the event because 
of this loop:

         $eventArray = array();
         foreach ($events as $event) {
             $this->open($event['calendar_id']);
             $this->_cache[$this->_calendar][$event['event_id']] = 
&new Kronolith_Event_sql($this, $event);
             $eventArray[] = 
&$this->_cache[$this->_calendar][$event['event_id']];
         }

         if ($getAll) {
             return $eventArray;
         }

The calendar_id could not be the same as the calendar of the copy 
which finally is selected, so the last
$kronolith_driver->deleteEvent($event->getId()) call fails.

A solution could be opening the event's calendar before deleting it:

     $kronolith_driver->open($event->getCalendar());
     return $kronolith_driver->deleteEvent($event->getId());

Any way, i think that getByUID shouldn't leave open any calendar when 
getAll flag is true, and ensure that opened calendar id is the same as 
the one of the event returned when getAll flag is false.

Regards

Saved Queries