Monotone-Parent: 796c6bb92f7f6f97be354aeb3b35c39751605e50
Monotone-Revision: 3b018c57691598e10f6e73b0f7fc31137f869040 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-17T18:07:23 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
6a58d17252
commit
71fe9f878b
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||||
(-fetchFields:...): don't use the privacySqlString twice.
|
(-fetchFields:...): don't use the privacySqlString twice.
|
||||||
|
The component parameter MUST be a NSString from now on. Fixed a
|
||||||
|
syntax problem in the where clause occuring when vtodo components
|
||||||
|
were requested.
|
||||||
|
|
||||||
* UI/MailPartViewers/UIxMailPartICalViewer.m (-storedEventObject):
|
* UI/MailPartViewers/UIxMailPartICalViewer.m (-storedEventObject):
|
||||||
use the new "storedEventFetched" bool ivar to specify whether we
|
use the new "storedEventFetched" bool ivar to specify whether we
|
||||||
|
|
|
@ -389,28 +389,6 @@ static NSArray *reducedReportQueryFields = nil;
|
||||||
|
|
||||||
/* fetching */
|
/* fetching */
|
||||||
|
|
||||||
- (NSString *) _sqlStringForComponent: (id) _component
|
|
||||||
{
|
|
||||||
NSString *sqlString;
|
|
||||||
NSArray *components;
|
|
||||||
|
|
||||||
if (_component)
|
|
||||||
{
|
|
||||||
if ([_component isKindOfClass: [NSArray class]])
|
|
||||||
components = _component;
|
|
||||||
else
|
|
||||||
components = [NSArray arrayWithObject: _component];
|
|
||||||
|
|
||||||
sqlString
|
|
||||||
= [NSString stringWithFormat: @"AND (c_component = '%@')",
|
|
||||||
[components componentsJoinedByString: @"' OR c_component = '"]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sqlString = @"";
|
|
||||||
|
|
||||||
return sqlString;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *) _sqlStringRangeFrom: (NSCalendarDate *) _startDate
|
- (NSString *) _sqlStringRangeFrom: (NSCalendarDate *) _startDate
|
||||||
to: (NSCalendarDate *) _endDate
|
to: (NSCalendarDate *) _endDate
|
||||||
{
|
{
|
||||||
|
@ -495,7 +473,7 @@ static NSArray *reducedReportQueryFields = nil;
|
||||||
from: (NSCalendarDate *) startDate
|
from: (NSCalendarDate *) startDate
|
||||||
to: (NSCalendarDate *) endDate
|
to: (NSCalendarDate *) endDate
|
||||||
title: (NSString *) title
|
title: (NSString *) title
|
||||||
component: (id) component
|
component: (NSString *) component
|
||||||
additionalFilters: (NSString *) filters
|
additionalFilters: (NSString *) filters
|
||||||
{
|
{
|
||||||
EOQualifier *qualifier;
|
EOQualifier *qualifier;
|
||||||
|
@ -516,7 +494,11 @@ static NSArray *reducedReportQueryFields = nil;
|
||||||
else
|
else
|
||||||
titleSqlString = @"";
|
titleSqlString = @"";
|
||||||
|
|
||||||
componentSqlString = [self _sqlStringForComponent: component];
|
if (component)
|
||||||
|
componentSqlString = [NSString stringWithFormat: @"AND c_component = '%@'",
|
||||||
|
component];
|
||||||
|
else
|
||||||
|
componentSqlString = @"";
|
||||||
filterSqlString = [NSMutableString string];
|
filterSqlString = [NSMutableString string];
|
||||||
if ([filters length])
|
if ([filters length])
|
||||||
[filterSqlString appendFormat: @"AND (%@)", filters];
|
[filterSqlString appendFormat: @"AND (%@)", filters];
|
||||||
|
@ -934,16 +916,16 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
{
|
{
|
||||||
EOQualifier *qualifier;
|
EOQualifier *qualifier;
|
||||||
GCSFolder *folder;
|
GCSFolder *folder;
|
||||||
NSMutableArray *fields, *ma = nil;
|
NSMutableArray *fields, *ma;
|
||||||
NSArray *records;
|
NSArray *records;
|
||||||
NSString *sql, *dateSqlString, *titleSqlString, *componentSqlString,
|
NSMutableString *baseWhere;
|
||||||
*privacySqlString, *currentLogin;
|
NSString *where, *dateSqlString, *privacySqlString, *currentLogin;
|
||||||
NSMutableString *filterSqlString;
|
|
||||||
NSCalendarDate *endDate;
|
NSCalendarDate *endDate;
|
||||||
NGCalendarDateRange *r;
|
NGCalendarDateRange *r;
|
||||||
BOOL rememberRecords;
|
BOOL rememberRecords, canCycle;
|
||||||
|
|
||||||
rememberRecords = [self _checkIfWeCanRememberRecords: _fields];
|
rememberRecords = [self _checkIfWeCanRememberRecords: _fields];
|
||||||
|
canCycle = [_component isEqualToString: @"vevent"];
|
||||||
// if (rememberRecords)
|
// if (rememberRecords)
|
||||||
// NSLog (@"we will remember those records!");
|
// NSLog (@"we will remember those records!");
|
||||||
|
|
||||||
|
@ -955,6 +937,12 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_component)
|
||||||
|
baseWhere = [NSMutableString stringWithFormat: @"AND c_component = '%@'",
|
||||||
|
_component];
|
||||||
|
else
|
||||||
|
baseWhere = [NSMutableString string];
|
||||||
|
|
||||||
if (_startDate)
|
if (_startDate)
|
||||||
{
|
{
|
||||||
if (_endDate)
|
if (_endDate)
|
||||||
|
@ -971,22 +959,16 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
dateSqlString = @"";
|
dateSqlString = @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([title length])
|
|
||||||
titleSqlString = [NSString stringWithFormat: @"AND (c_title"
|
|
||||||
@" isCaseInsensitiveLike: '%%%@%%')",
|
|
||||||
[title stringByReplacingString: @"'" withString: @"\\'\\'"]];
|
|
||||||
else
|
|
||||||
titleSqlString = @"";
|
|
||||||
|
|
||||||
componentSqlString = [self _sqlStringForComponent: _component];
|
|
||||||
|
|
||||||
filterSqlString = [NSMutableString string];
|
|
||||||
if ([filters length])
|
|
||||||
[filterSqlString appendFormat: @"AND (%@)", filters];
|
|
||||||
|
|
||||||
privacySqlString = [self _privacySqlString];
|
privacySqlString = [self _privacySqlString];
|
||||||
if ([privacySqlString length])
|
if ([privacySqlString length])
|
||||||
[filterSqlString appendFormat: @"AND (%@)", privacySqlString];
|
[baseWhere appendFormat: @"AND %@", privacySqlString];
|
||||||
|
|
||||||
|
if ([title length])
|
||||||
|
[baseWhere appendFormat: @"AND c_title isCaseInsensitiveLike: '%%%@%%'",
|
||||||
|
[title stringByReplacingString: @"'" withString: @"\\'\\'"]];
|
||||||
|
|
||||||
|
if ([filters length])
|
||||||
|
[baseWhere appendFormat: @"AND (%@)", filters];
|
||||||
|
|
||||||
/* prepare mandatory fields */
|
/* prepare mandatory fields */
|
||||||
|
|
||||||
|
@ -1000,19 +982,15 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
if (logger)
|
if (logger)
|
||||||
[self debugWithFormat:@"should fetch (%@=>%@) ...", _startDate, endDate];
|
[self debugWithFormat:@"should fetch (%@=>%@) ...", _startDate, endDate];
|
||||||
|
|
||||||
// We treat recurrent tasks as normal components
|
if (canCycle)
|
||||||
if ([_component caseInsensitiveCompare: @"vtodo"] == NSOrderedSame)
|
where = [NSString stringWithFormat: @"%@ %@ AND c_iscycle = 0",
|
||||||
sql = @"";
|
baseWhere, dateSqlString];
|
||||||
else
|
else
|
||||||
sql = @"(c_iscycle = 0) ";
|
where = baseWhere;
|
||||||
|
|
||||||
sql = [sql stringByAppendingFormat: @"%@ %@ %@ %@",
|
|
||||||
dateSqlString, titleSqlString, componentSqlString,
|
|
||||||
filterSqlString];
|
|
||||||
|
|
||||||
/* fetch non-recurrent apts first */
|
|
||||||
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
|
|
||||||
|
|
||||||
|
/* fetch non-recurrent apts first */
|
||||||
|
qualifier = [EOQualifier qualifierWithQualifierFormat:
|
||||||
|
[where substringFromIndex: 4]];
|
||||||
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
||||||
if (records)
|
if (records)
|
||||||
{
|
{
|
||||||
|
@ -1023,15 +1001,15 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
[records count], records];
|
[records count], records];
|
||||||
ma = [NSMutableArray arrayWithArray: records];
|
ma = [NSMutableArray arrayWithArray: records];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ma = nil;
|
||||||
|
|
||||||
/* fetch recurrent apts now. we do NOT consider events with no cycle end. */
|
/* fetch recurrent apts now. we do NOT consider events with no cycle end. */
|
||||||
if (_endDate || filters)
|
// || _endDate || filters)
|
||||||
|
if (canCycle)
|
||||||
{
|
{
|
||||||
sql = [NSString stringWithFormat: @"(c_iscycle = 1) %@ %@ %@", titleSqlString,
|
where = [NSString stringWithFormat: @"%@ AND c_iscycle = 1", baseWhere];
|
||||||
componentSqlString, filterSqlString];
|
qualifier = [EOQualifier qualifierWithQualifierFormat: [where substringFromIndex: 4]];
|
||||||
|
|
||||||
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
|
|
||||||
|
|
||||||
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
records = [folder fetchFields: fields matchingQualifier: qualifier];
|
||||||
if (records)
|
if (records)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue