From 3f8d374d638f9259254deefe0d856e58e73368a2 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Sat, 17 Nov 2012 15:38:29 -0500 Subject: [PATCH] Fix for bug #2035 --- .../Appointments/SOGoAppointmentFolder.m | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index c4b761963..4f2946731 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -2885,11 +2885,26 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir timezone: (iCalTimeZone *) timezone { SOGoAppointmentObject *object; - NSString *uid; NSMutableString *content; + NSString *uid; uid = [self globallyUniqueObjectId]; [event setUid: uid]; + + // We first look if there's an event with the same UID in our calendar. If not, + // let's reuse what is in the event, otherwise generate a new GUID and use it. + uid = [event uid]; + + object = [self lookupName: uid + inContext: context + acquire: NO]; + + if (object && ![object isKindOfClass: [NSException class]]) + { + uid = [self globallyUniqueObjectId]; + [event setUid: uid]; + } + object = [SOGoAppointmentObject objectWithName: uid inContainer: self]; [object setIsNew: YES]; @@ -3024,7 +3039,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir acquire: NO]; if (master) { - // Associate the occurrence to the master event + // Associate the occurrence to the master event and skip the actual import process masterCalendar = [master calendar: NO secure: NO]; [masterCalendar addToEvents: event]; if (timezone)