mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-17 07:33:57 +00:00
fix(calendar): Update c_startdate field when updating event. Fixes #4376
This commit is contained in:
@@ -987,7 +987,7 @@ andAttribute: (EOAttribute *)_attribute
|
||||
NSDictionary *currentRow;
|
||||
NSNumber *storedVersion;
|
||||
BOOL isNewRecord, hasInsertDelegate, hasUpdateDelegate;
|
||||
NSCalendarDate *nowDate;
|
||||
NSCalendarDate *nowDate, *startDate;
|
||||
NSNumber *now;
|
||||
EOEntity *quickTableEntity, *storeTableEntity;
|
||||
NSArray *rows;
|
||||
@@ -1002,6 +1002,7 @@ andAttribute: (EOAttribute *)_attribute
|
||||
error = nil;
|
||||
nowDate = [NSCalendarDate date];
|
||||
now = [NSNumber numberWithUnsignedInt:[nowDate timeIntervalSince1970]];
|
||||
startDate = nil;
|
||||
|
||||
if (doLogStore)
|
||||
[self logWithFormat:@"should store content: '%@'\n%@", _name, _content];
|
||||
@@ -1071,6 +1072,7 @@ andAttribute: (EOAttribute *)_attribute
|
||||
|
||||
[contentRow setObject:_name forKey:@"c_name"];
|
||||
[contentRow setObject:now forKey:@"c_lastmodified"];
|
||||
|
||||
if (isNewRecord)
|
||||
{
|
||||
[contentRow setObject:now forKey:@"c_creationdate"];
|
||||
@@ -1141,6 +1143,14 @@ andAttribute: (EOAttribute *)_attribute
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update c_startdate for appointments
|
||||
if ([theComponent respondsToSelector:@selector(startDate)]) {
|
||||
startDate = [theComponent startDate];
|
||||
if (startDate) {
|
||||
[quickRow setObject:[NSNumber numberWithUnsignedInt:[startDate timeIntervalSince1970]] forKey:@"c_startdate"];
|
||||
}
|
||||
}
|
||||
|
||||
if (!ofFlags.sameTableForQuick)
|
||||
error = (hasUpdateDelegate
|
||||
? [quickChannel updateRowX: quickRow
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
- (void) setMethod: (NSString *) _method;
|
||||
- (NSString *) method;
|
||||
|
||||
// - (void) setStartDate: (NSCalendarDate *) newStartDate;
|
||||
- (NSCalendarDate *) startDate;
|
||||
|
||||
- (NSArray *) events;
|
||||
- (NSArray *) todos;
|
||||
- (NSArray *) journals;
|
||||
|
||||
@@ -133,8 +133,27 @@
|
||||
- (NSString *) method
|
||||
{
|
||||
return [[self uniqueChildWithTag: @"method"] flattenedValuesForKey: @""];
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) startDate
|
||||
{
|
||||
// Parse all dtstart to find the earlier
|
||||
NSCalendarDate *calendarDate, *tmpCalendarDate;
|
||||
NSUInteger i;
|
||||
|
||||
calendarDate = nil;
|
||||
if ([[self allObjects] count] > 0) {
|
||||
calendarDate = [[[[self allObjects] objectAtIndex: 0] uniqueChildWithTag: @"dtstart"] dateTime];
|
||||
for (i = 0U ; i < [[self allObjects] count] ; i++) {
|
||||
tmpCalendarDate = [[[[self allObjects] objectAtIndex: i] uniqueChildWithTag: @"dtstart"] dateTime];
|
||||
if ([tmpCalendarDate timeIntervalSince1970] < [calendarDate timeIntervalSince1970]) calendarDate = tmpCalendarDate;
|
||||
}
|
||||
}
|
||||
|
||||
return calendarDate;
|
||||
}
|
||||
|
||||
|
||||
- (void) addToEvents: (iCalEvent *) _event
|
||||
{
|
||||
[self addChild: _event];
|
||||
|
||||
Reference in New Issue
Block a user