(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] handle empty body data when forwarding mails (#3581)
- [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)
------------------

View File

@ -1453,14 +1453,35 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
else
ma = nil;
// Fetch recurrent apts now, *excluding* events with no cycle end.
if (canCycle && _endDate)
// Fetch recurrent apts now. We support the following scenarios:
// "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
condition */
unsigned int delta;
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];
/* replace the date range */
// replace the date range
if (r)
{
[baseWhere removeLastObject];
@ -1483,6 +1504,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
ma = [NSMutableArray arrayWithArray: records];
}
}
if (!ma)
{
[self errorWithFormat: @"(%s): fetch failed!", __PRETTY_FUNCTION__];