diff --git a/SoObjects/Appointments/SOGoAppointmentObject.h b/SoObjects/Appointments/SOGoAppointmentObject.h index b6edd16b4f..76d57064df 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.h +++ b/SoObjects/Appointments/SOGoAppointmentObject.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007-2019 Inverse inc. + Copyright (C) 2007-2020 Inverse inc. This file is part of SOGo @@ -37,6 +37,7 @@ @interface SOGoAppointmentObject : SOGoCalendarComponent { + BOOL _resourceHasAutoAccepted; } - (NSException *) changeParticipationStatus: (NSString *) status @@ -61,6 +62,7 @@ - (NSException *) updateContentWithCalendar: (iCalCalendar *) calendar fromRequest: (WORequest *) rq; +- (BOOL) resourceHasAutoAccepted; @end #endif /* __Appointments_SOGoAppointmentObject_H__ */ diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 77a31ec958..b5bd8b739c 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2007-2019 Inverse inc. + Copyright (C) 2007-2020 Inverse inc. This file is part of SOGo @@ -627,6 +627,8 @@ - (NSException *) _handleAttendeesConflicts: (NSArray *) theAttendees NSString *currentUID; SOGoUser *user, *currentUser; + _resourceHasAutoAccepted = NO; + // Build a list of the attendees uids attendees = [NSMutableArray arrayWithCapacity: [theAttendees count]]; enumerator = [theAttendees objectEnumerator]; @@ -761,10 +763,8 @@ - (NSException *) _handleAttendeesConflicts: (NSArray *) theAttendees if ([fbInfo count]) { - BOOL resourceHasAutoAccepted; SOGoDateFormatter *formatter; - resourceHasAutoAccepted = NO; formatter = [[context activeUser] dateFormatterInContext: context]; if ([user isResource]) @@ -781,7 +781,7 @@ - (NSException *) _handleAttendeesConflicts: (NSArray *) theAttendees { [[currentAttendee attributes] removeObjectForKey: @"RSVP"]; [currentAttendee setParticipationStatus: iCalPersonPartStatAccepted]; - resourceHasAutoAccepted = YES; + _resourceHasAutoAccepted = YES; } } else @@ -814,7 +814,7 @@ - (NSException *) _handleAttendeesConflicts: (NSArray *) theAttendees // We are dealing with a normal attendee. Lets check if we have conflicts, unless // we are being asked to force the save anyway // - if (!forceSave && !resourceHasAutoAccepted) + if (!forceSave && !_resourceHasAutoAccepted) { NSMutableDictionary *info; NSMutableArray *conflicts; @@ -868,6 +868,7 @@ - (NSException *) _handleAttendeesConflicts: (NSArray *) theAttendees // set the resource as one! [[currentAttendee attributes] removeObjectForKey: @"RSVP"]; [currentAttendee setParticipationStatus: iCalPersonPartStatAccepted]; + _resourceHasAutoAccepted = YES; } }