(fix) show repeating events when we ask for "All" or "Future" events (fixes #69)

pull/203/head
Ludovic Marcotte 2016-03-22 10:44:23 -04:00
parent 3dd5ca772b
commit 2c038d641a
2 changed files with 28 additions and 5 deletions

1
NEWS
View File

@ -22,6 +22,7 @@ Bug fixes
- [web] respect the LDAP attributes mapping in the list view - [web] respect the LDAP attributes mapping in the list view
- [web] handle empty body data when forwarding mails (#3581) - [web] handle empty body data when forwarding mails (#3581)
- [eas] correctly set EAS message class for S/MIME messages (#3576) - [eas] correctly set EAS message class for S/MIME messages (#3576)
- [web] show repeating events when we ask for "All" or "Future" events (#69)
3.0.2 (2016-03-04) 3.0.2 (2016-03-04)
------------------ ------------------

View File

@ -1453,14 +1453,35 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
else else
ma = nil; ma = nil;
// Fetch recurrent apts now, *excluding* events with no cycle end. // Fetch recurrent apts now. We support the following scenarios:
if (canCycle && _endDate) // "All events" - so the start and end date is nil
// "All future events" - start is defined, date is nil
if (canCycle)
{ {
/* we know the last element of "baseWhere" is the c_iscycle unsigned int delta;
condition */
delta = 1;
// If we don't have a start date, we use the current date - 1 year
if (!_startDate)
{
_startDate = [[NSCalendarDate date] dateByAddingYears: -1 months: 0 days: 0 hours: 0 minutes: 0 seconds: 0];
delta++;
}
// We if we don't have an end date, we use the start date + 1 year
if (!_endDate)
{
endDate = [_startDate dateByAddingYears: delta months: 0 days: 0 hours: 0 minutes: 0 seconds: 0];
}
r = [NGCalendarDateRange calendarDateRangeWithStartDate: _startDate
endDate: endDate];
// we know the last element of "baseWhere" is the c_iscycle condition
[baseWhere removeLastObject]; [baseWhere removeLastObject];
/* replace the date range */ // replace the date range
if (r) if (r)
{ {
[baseWhere removeLastObject]; [baseWhere removeLastObject];
@ -1483,6 +1504,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
ma = [NSMutableArray arrayWithArray: records]; ma = [NSMutableArray arrayWithArray: records];
} }
} }
if (!ma) if (!ma)
{ {
[self errorWithFormat: @"(%s): fetch failed!", __PRETTY_FUNCTION__]; [self errorWithFormat: @"(%s): fetch failed!", __PRETTY_FUNCTION__];