diff --git a/NEWS b/NEWS index 241ed25d7c..3329b17769 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,7 @@ Bug fixes - [web] fixed display of message content when enabling auto-reply (#3940) - [web] don't allow to create lists in a remote address book (not yet supported) - [web] fixed attached links in task viewer (#3963) + - [web] avoid duplicate mail entries in contact of LDAP-based address book (#3941) - [eas] properly skip folders we don't want to synchronize (#3943) - [eas] fixed 30 mins freebusy offset with S Planner - [eas] now correctly handles reminders on tasks (#3964) diff --git a/SoObjects/Contacts/NGVCard+SOGo.h b/SoObjects/Contacts/NGVCard+SOGo.h index 766a911207..16a36ec37d 100644 --- a/SoObjects/Contacts/NGVCard+SOGo.h +++ b/SoObjects/Contacts/NGVCard+SOGo.h @@ -40,6 +40,7 @@ - (NSString *) workCompany; - (NSString *) fullName; +- (NSArray *) emails; - (NSArray *) secondaryEmails; - (NSString *) workPhone; diff --git a/SoObjects/Contacts/NGVCard+SOGo.m b/SoObjects/Contacts/NGVCard+SOGo.m index 2e81e241f5..e5adc3c01b 100644 --- a/SoObjects/Contacts/NGVCard+SOGo.m +++ b/SoObjects/Contacts/NGVCard+SOGo.m @@ -236,6 +236,7 @@ - (void) _setPhoneValues: (NSDictionary *) ldifRecord - (void) _setEmails: (NSDictionary *) ldifRecord { CardElement *homeMail; + NSString* mail; // Emails from the configured mail fields of the source have already been extracted in // [LDAPSource _fillEmailsOfEntry:intoLDIFRecord:] @@ -243,9 +244,11 @@ - (void) _setEmails: (NSDictionary *) ldifRecord ofType: @"work" withValue: [ldifRecord objectForKey: @"c_emails"]]; // When importing an LDIF file, add the default mail attribute - [self addElementWithTag: @"email" - ofType: @"work" - withValue: [ldifRecord objectForKey: @"mail"]]; + mail = [ldifRecord objectForKey: @"mail"]; + if ([mail length] && ![[self emails] containsObject: mail]) + [self addElementWithTag: @"email" + ofType: @"work" + withValue: [ldifRecord objectForKey: @"mail"]]; homeMail = [self elementWithTag: @"email" ofType: @"home"]; [homeMail setSingleValue: [ldifRecord objectForKey: @"mozillasecondemail"] forKey: @""]; [[self uniqueChildWithTag: @"x-mozilla-html"]