From 9f85aaffb997a8baa41322021e4a76324a50b9a2 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 6 Mar 2013 00:29:45 +0000 Subject: - If date-type fields are cleared, and allow NULLs, save the cell value as NULL; this implements Issue #1638 --- Source/SPCustomQuery.m | 2 +- Source/SPTableContent.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Source') diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index ba3eca62..08b5838c 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -1883,7 +1883,7 @@ if ( [[anObject description] isEqualToString:@"CURRENT_TIMESTAMP"] ) { newObject = @"CURRENT_TIMESTAMP"; } else if ([anObject isEqualToString:[prefs stringForKey:SPNullValue]] - || (([columnTypeGroup isEqualToString:@"float"] || [columnTypeGroup isEqualToString:@"integer"]) + || (([columnTypeGroup isEqualToString:@"float"] || [columnTypeGroup isEqualToString:@"integer"] || [columnTypeGroup isEqualToString:@"date"]) && [[anObject description] isEqualToString:@""])) { newObject = @"NULL"; diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 2ca31b70..85241ce2 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2882,9 +2882,9 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper NSString *fieldTypeGroup = [fieldDefinition objectForKey:@"typegrouping"]; // Use NULL when the user has entered the nullValue string defined in the preferences, - // or when a numeric field is empty. + // or when a numeric or date field is empty. if ([rowObject isNSNull] - || (([fieldTypeGroup isEqualToString:@"float"] || [fieldTypeGroup isEqualToString:@"integer"]) + || (([fieldTypeGroup isEqualToString:@"float"] || [fieldTypeGroup isEqualToString:@"integer"] || [fieldTypeGroup isEqualToString:@"date"]) && [[rowObject description] isEqualToString:@""] && [[fieldDefinition objectForKey:@"null"] boolValue])) { fieldValue = @"NULL"; -- cgit v1.2.3