Fix support for recurrent tasks

This commit is contained in:
Francis Lachapelle
2017-01-06 20:58:15 -05:00
parent cde6fe520c
commit 62df4fffa3
2 changed files with 10 additions and 6 deletions
@@ -30,6 +30,7 @@
#import <NGObjWeb/NSException+HTTP.h> #import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/SoObject+SoDAV.h> #import <NGObjWeb/SoObject+SoDAV.h>
#import <NGObjWeb/WOApplication.h>
#import <NGObjWeb/WOContext+SoObjects.h> #import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WOMessage.h> #import <NGObjWeb/WOMessage.h>
#import <NGObjWeb/WORequest.h> #import <NGObjWeb/WORequest.h>
@@ -995,7 +996,6 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
NSCalendarDate *recurrenceId, *masterEndDate, *endDate; NSCalendarDate *recurrenceId, *masterEndDate, *endDate;
NSMutableDictionary *newRecord; NSMutableDictionary *newRecord;
NGCalendarDateRange *newRecordRange; NGCalendarDateRange *newRecordRange;
NSComparisonResult compare;
NSNumber *dateSecs; NSNumber *dateSecs;
id master; id master;
@@ -1026,13 +1026,13 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
{ {
master = [[[component parent] events] objectAtIndex: 0]; master = [[[component parent] events] objectAtIndex: 0];
masterEndDate = [master endDate]; masterEndDate = [master endDate];
endDate = [component endDate]; endDate = [(iCalEvent*) component endDate];
} }
else else
{ {
master = [[[component parent] todos] objectAtIndex: 0]; master = [[[component parent] todos] objectAtIndex: 0];
masterEndDate = [master due]; masterEndDate = [master due];
endDate = [component due]; endDate = [(iCalToDo*) component due];
} }
delta = [masterEndDate timeIntervalSinceDate: [master startDate]]; delta = [masterEndDate timeIntervalSinceDate: [master startDate]];
@@ -1046,7 +1046,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
if (recordIndex > -1) if (recordIndex > -1)
{ {
if ([dateRange containsDate: [component startDate]] || if ([dateRange containsDate: [component startDate]] ||
[dateRange containsDate: endDate]) (endDate && [dateRange containsDate: endDate]))
{ {
// We must pass nil to :container here in order to avoid re-entrancy issues. // We must pass nil to :container here in order to avoid re-entrancy issues.
newRecord = [self _fixupRecord: [component quickRecordFromContent: nil container: nil]]; newRecord = [self _fixupRecord: [component quickRecordFromContent: nil container: nil]];
+6 -2
View File
@@ -1,6 +1,6 @@
/* iCalToDot+SOGo.m - this file is part of SOGo /* iCalToDot+SOGo.m - this file is part of SOGo
* *
* Copyright (C) 2008-2014 Inverse inc. * Copyright (C) 2008-2017 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
@@ -188,7 +188,11 @@
- (NSTimeInterval) occurenceInterval - (NSTimeInterval) occurenceInterval
{ {
return [[self due] timeIntervalSinceDate: [self startDate]]; if ([self due])
return [[self due] timeIntervalSinceDate: [self startDate]];
else
// When no due date is defined, base recurrence calculation on a 60-minute duration
return 3600;
} }
@end @end