Remove invalid occurrences when saving master
parent
452083e767
commit
0c5b5446dd
1
NEWS
1
NEWS
|
@ -4,6 +4,7 @@
|
||||||
Enhancements
|
Enhancements
|
||||||
- [web] now possible to show events/task for the current year
|
- [web] now possible to show events/task for the current year
|
||||||
- [web] show current ordering setting in lists
|
- [web] show current ordering setting in lists
|
||||||
|
- [web] remove invalid occurrences when modifying a recurrent event
|
||||||
- [web] updated Angular Material to version 1.1.9
|
- [web] updated Angular Material to version 1.1.9
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2007-2016 Inverse inc.
|
Copyright (C) 2007-2018 Inverse inc.
|
||||||
|
|
||||||
This file is part of SOGo
|
This file is part of SOGo
|
||||||
|
|
||||||
|
@ -49,6 +49,8 @@
|
||||||
alarm: (iCalAlarm *) alarm
|
alarm: (iCalAlarm *) alarm
|
||||||
forRecurrenceId: (NSCalendarDate *) _recurrenceId;
|
forRecurrenceId: (NSCalendarDate *) _recurrenceId;
|
||||||
|
|
||||||
|
- (void) prepareDeleteOccurence: (iCalEvent *) occurence;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Old CalDAV scheduling (draft 4 and below) methods. We keep them since we still
|
// Old CalDAV scheduling (draft 4 and below) methods. We keep them since we still
|
||||||
// advertise for its support but we do everything within the calendar-auto-scheduling code
|
// advertise for its support but we do everything within the calendar-auto-scheduling code
|
||||||
|
|
|
@ -317,16 +317,23 @@
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an date exception.
|
// Add an date exception.
|
||||||
event = (iCalRepeatableEntityObject*)[calendar firstChildWithTag: [object componentTag]];
|
event = (iCalRepeatableEntityObject*)[calendar firstChildWithTag: [object componentTag]];
|
||||||
[event addToExceptionDates: recurrenceId];
|
if (event)
|
||||||
|
{
|
||||||
[event increaseSequence];
|
[event addToExceptionDates: recurrenceId];
|
||||||
[event setLastModified: [NSCalendarDate calendarDate]];
|
[event increaseSequence];
|
||||||
|
[event setLastModified: [NSCalendarDate calendarDate]];
|
||||||
|
|
||||||
// We save the updated iCalendar in the database.
|
// We save the updated iCalendar in the database.
|
||||||
[object saveCalendar: calendar];
|
[object saveCalendar: calendar];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No more child; kill the parent
|
||||||
|
[object delete];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* UIxAppointmentEditor.m - this file is part of SOGo
|
/* UIxAppointmentEditor.m - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2017 Inverse inc.
|
* Copyright (C) 2007-2018 Inverse inc.
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -45,6 +45,7 @@
|
||||||
#import <Appointments/iCalCalendar+SOGo.h>
|
#import <Appointments/iCalCalendar+SOGo.h>
|
||||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||||
#import <Appointments/iCalPerson+SOGo.h>
|
#import <Appointments/iCalPerson+SOGo.h>
|
||||||
|
#import <Appointments/iCalRepeatableEntityObject+SOGo.h>
|
||||||
#import <Appointments/SOGoAppointmentFolder.h>
|
#import <Appointments/SOGoAppointmentFolder.h>
|
||||||
#import <Appointments/SOGoAppointmentObject.h>
|
#import <Appointments/SOGoAppointmentObject.h>
|
||||||
#import <Appointments/SOGoAppointmentOccurence.h>
|
#import <Appointments/SOGoAppointmentOccurence.h>
|
||||||
|
@ -189,14 +190,20 @@
|
||||||
|
|
||||||
- (NSException *) _adjustRecurrentRules
|
- (NSException *) _adjustRecurrentRules
|
||||||
{
|
{
|
||||||
iCalEvent *event;
|
NSArray *events;
|
||||||
iCalRecurrenceRule *rule;
|
NSCalendarDate *untilDate, *recurrenceId;
|
||||||
NSEnumerator *rules;
|
NSEnumerator *rules;
|
||||||
NSException *ex;
|
NSException *ex;
|
||||||
NSCalendarDate *untilDate;
|
|
||||||
SOGoUserDefaults *ud;
|
|
||||||
NSTimeZone *timeZone;
|
NSTimeZone *timeZone;
|
||||||
|
SOGoAppointmentObject *co;
|
||||||
|
SOGoUserDefaults *ud;
|
||||||
|
iCalCalendar *calendar;
|
||||||
|
iCalEvent *event;
|
||||||
|
iCalRecurrenceRule *rule;
|
||||||
|
iCalRepeatableEntityObject *masterEvent, *occurrence;
|
||||||
|
int count, max;
|
||||||
|
|
||||||
|
co = [self clientObject];
|
||||||
event = [self event];
|
event = [self event];
|
||||||
rules = [[event recurrenceRules] objectEnumerator];
|
rules = [[event recurrenceRules] objectEnumerator];
|
||||||
ex = nil;
|
ex = nil;
|
||||||
|
@ -234,6 +241,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove invalid occurrences
|
||||||
|
calendar = [event parent];
|
||||||
|
events = [calendar events];
|
||||||
|
masterEvent = [events objectAtIndex: 0];
|
||||||
|
max = [events count];
|
||||||
|
for (count = max - 1; count > 0; count--)
|
||||||
|
{
|
||||||
|
occurrence = [events objectAtIndex: count];
|
||||||
|
recurrenceId = [occurrence recurrenceId];
|
||||||
|
if (recurrenceId && ![masterEvent doesOccurOnDate: recurrenceId])
|
||||||
|
{
|
||||||
|
[co prepareDeleteOccurence: (iCalEvent *)occurrence]; // notify attendees, update their calendars
|
||||||
|
[calendar removeChild: occurrence];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ex;
|
return ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue