From 85e61ecc1be40816f89f7b4cb881554b0a32b7df Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 21 Oct 2019 15:32:13 -0400 Subject: [PATCH] Add missing contact fields for sorting Fixes #4799 --- SoObjects/Contacts/SOGoContactSourceFolder.m | 22 ++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/SoObjects/Contacts/SOGoContactSourceFolder.m b/SoObjects/Contacts/SOGoContactSourceFolder.m index f6e636f17..23254a1c6 100644 --- a/SoObjects/Contacts/SOGoContactSourceFolder.m +++ b/SoObjects/Contacts/SOGoContactSourceFolder.m @@ -247,6 +247,18 @@ data = @""; [newRecord setObject: data forKey: @"c_cn"]; + // sn => c_sn + data = [oldRecord objectForKey: @"sn"]; + if (!data) + data = @""; + [newRecord setObject: data forKey: @"c_sn"]; // for sorting + + // givenname => c_givenname + data = [oldRecord objectForKey: @"givenname"]; + if (!data) + data = @""; + [newRecord setObject: data forKey: @"c_givenname"]; + if ([[SOGoSystemDefaults sharedSystemDefaults] enableDomainBasedUID]) { data = [oldRecord objectForKey: @"c_domain"]; @@ -296,7 +308,7 @@ data = [oldRecord objectForKey: @"nscpaimscreenname"]; if (![data length]) data = @""; - [newRecord setObject: data forKey: @"c_screenname"]; + [newRecord setObject: data forKey: @"c_screenname"]; // for sorting // o => org data = [oldRecord objectForKey: @"o"]; @@ -304,9 +316,9 @@ [newRecord setObject: data forKey: @"org"]; else data = @""; - [newRecord setObject: data forKey: @"c_o"]; + [newRecord setObject: data forKey: @"c_o"]; // for sorting - // telephonenumber || cellphone || homephone => phones[] + // telephonenumber || cellphone || homephone => phones[] & c_telephonenumber data = [oldRecord objectForKey: @"telephonenumber"]; if (![data length]) data = [oldRecord objectForKey: @"cellphone"]; @@ -320,7 +332,7 @@ } else data = @""; - [newRecord setObject: data forKey: @"c_telephonenumber"]; + [newRecord setObject: data forKey: @"c_telephonenumber"]; // for sorting // Custom attribute for group lookups. See LDAPSource.m. data = [oldRecord objectForKey: @"isGroup"]; @@ -375,8 +387,6 @@ { oldRecord = [NSMutableDictionary dictionary]; [oldRecord addEntriesFromDictionary: o]; - if ([source isKindOfClass: [LDAPSource class]]) - [(LDAPSource *)source applyContactMappingToResult: oldRecord]; [newRecords addObject: [self _flattenedRecord: oldRecord]]; }