View Issue Details

IDProjectCategoryView StatusLast Update
0000846SOGoBackend Address Bookpublic2012-02-04 23:28
ReporterHans Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0000846: Export and import fields for contacts do not match
Description

Export a contact, import it back, a lots of fields are now empty.

TagsNo tags attached.

Activities

ludovic

ludovic

2010-09-20 22:53

administrator   ~0001494

Provide an example.

Hans

Hans

2010-09-21 00:46

reporter   ~0001495

Just fill out all fields in a contact
export it
delete the original
import back the ldif
lots of empty fields

Hans.

Hans

Hans

2010-09-21 00:47

reporter   ~0001496

This was done on the demo site

cameronb

cameronb

2011-06-01 20:56

reporter   ~0002515

Example with SOGo 1.3.7a

Exported from SOGo via web interface:
dn: cn=John Cameron,mail=cameronjohn@domain.com
mozillaHomeStreet2: RR2
homePhone: 519-879-9634
mozillaHomeLocalityName: Cambridge
sn: Cameron
mail: cameronjohn@domain.com
mozillaSecondEmail: johncameron@domain.ca
mozillaHomeCountryName: Canada
givenName: John
homeStreet: Apt. 123\, 456 Bedridge Drive
cn: John Cameron
modifytimestamp: 0Z
mozillaHomePostalCode: X3X 3X3
mozillaHomeState: ON
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: mozillaAbPersonObsolete

Import into SOGo via web interface and the following do not get imported:
mozillaHomeStreet2: RR2
mozillaHomeLocalityName: Cambridge
mozillaSecondEmail: johncameron@domain.ca
mozillaHomeCountryName: Canada
homeStreet: Apt. 123\, 456 Bedridge Drive
mozillaHomePostalCode: X3X 3X3
mozillaHomeState: ON

It looks like the mozillaAbPersonObsolete attributes do not get imported. Work address fields are correctly imported.

Bill C.

2011-06-09 14:28

 

SOGoContactLDIFEntry.m.diff (5,104 bytes)   
#
# old_revision [64282771e1fb25846e93ccef41b7198b11c569f6]
#
# patch "SoObjects/Contacts/SOGoContactLDIFEntry.m"
#  from [71db282d913c7028250e0000ec1c0138370ebb7f]
#    to [ab9600cb1abfa069bb08014e6839995b1f121fcc]
#
============================================================
--- SoObjects/Contacts/SOGoContactLDIFEntry.m	71db282d913c7028250e0000ec1c0138370ebb7f
+++ SoObjects/Contacts/SOGoContactLDIFEntry.m	ab9600cb1abfa069bb08014e6839995b1f121fcc
@@ -87,6 +87,8 @@
     [vCard addTel: info
            types: [NSArray arrayWithObjects: @"home", @"voice", nil]];
   info = [ldifEntry objectForKey: @"fax"];
+  if (!info)
+    info = [ldifEntry objectForKey: @"facsimiletelephonenumber"];
   if (info)
     [vCard addTel: info
            types: [NSArray arrayWithObjects: @"work", @"fax", nil]];
@@ -109,7 +111,7 @@
 
 - (NGVCard *) vCard
 {
-  NSString *info, *surname, *streetAddress, *location, *region, *postalCode, *country, *org, *orgunit;
+  NSString *info, *surname, *streetAddress2, *streetAddress, *location, *region, *postalCode, *country, *org, *orgunit, *year, *month, *day;
   CardElement *element;
   unsigned int count;
 
@@ -156,8 +158,19 @@
       if (info)
         [vcard addEmail: info
                types: [NSArray arrayWithObjects: @"internet", @"pref", nil]];
+      info = [ldifEntry objectForKey: @"mozillasecondemail"];
+      if (info)
+        [vcard addEmail: info
+               types: [NSArray arrayWithObjects: @"internet", nil]];
+      info = [ldifEntry objectForKey: @"nsaimid"];
+      if (info)
+        [vcard addChildWithTag: @"x-aim"
+               types: nil
+               singleValue: info];
       [self _setPhonesOfVCard: vcard];
 
+      streetAddress2 = [ldifEntry objectForKey: @"mozillaworkstreet2"];
+
       streetAddress = [ldifEntry objectForKey: @"street"];
       if (!streetAddress)
         streetAddress = [ldifEntry objectForKey: @"streetaddress"];
@@ -182,6 +195,8 @@
                                  attributes: nil values: nil];
       [element setValue: 0 ofAttribute: @"type" to: @"work"];
 
+      if (streetAddress2)
+        [element setValue: 1 to: streetAddress2];
       if (streetAddress)
         [element setValue: 2 to: streetAddress];
       if (location)
@@ -193,9 +208,59 @@
       if (country)
 	[element setValue: 6 to: country];
       
-      if (streetAddress || location || region || postalCode || country)
+      if (streetAddress2 || streetAddress || location || region || postalCode || country)
         [vcard addChild: element];
 
+      info = [ldifEntry objectForKey: @"mozillaworkurl"];
+      if (!info)
+        info = [ldifEntry objectForKey: @"workurl"];
+      if (info)
+        [vcard addChildWithTag: @"url"
+               types: [NSArray arrayWithObjects: @"work", nil]
+               singleValue: info];
+
+      streetAddress2 = [ldifEntry objectForKey: @"mozillahomestreet2"];
+
+      streetAddress = [ldifEntry objectForKey: @"mozillahomestreet"];
+      if (!streetAddress)
+        streetAddress = [ldifEntry objectForKey: @"homestreet"];
+
+      location = [ldifEntry objectForKey: @"mozillahomelocalityname"];
+
+      region = [ldifEntry objectForKey: @"mozillahomestate"];
+
+      postalCode = [ldifEntry objectForKey: @"mozillahomepostalcode"];
+
+      country = [ldifEntry objectForKey: @"mozillahomecountryname"];
+
+      element = [CardElement elementWithTag: @"adr"
+                                 attributes: nil values: nil];
+      [element setValue: 0 ofAttribute: @"type" to: @"home"];
+
+      if (streetAddress2)
+        [element setValue: 1 to: streetAddress2];
+      if (streetAddress)
+        [element setValue: 2 to: streetAddress];
+      if (location)
+        [element setValue: 3 to: location];
+      if (region)
+        [element setValue: 4 to: region];
+      if (postalCode)
+        [element setValue: 5 to: postalCode];
+      if (country)
+        [element setValue: 6 to: country];
+
+      if (streetAddress2 || streetAddress || location || region || postalCode || country)
+        [vcard addChild: element];
+
+      info = [ldifEntry objectForKey: @"mozillahomeurl"];
+      if (!info)
+        info = [ldifEntry objectForKey: @"homeurl"];
+      if (info)
+        [vcard addChildWithTag: @"url"
+               types: [NSArray arrayWithObjects: @"home", nil]
+               singleValue: info];
+
       // We handle the org/orgunit stuff
       element = [CardElement elementWithTag: @"org"
                              attributes: nil values: nil];
@@ -212,6 +277,14 @@
       if (org || orgunit)
 	[vcard addChild: element];
 
+      year = [ldifEntry objectForKey: @"birthyear"];
+      month = [ldifEntry objectForKey: @"birthmonth"];
+      day = [ldifEntry objectForKey: @"birthday"];
+      if (year && month && day)
+        [vcard setBday: [NSString stringWithFormat: @"%04d-%02d-%02d",
+                                  [year intValue], [month intValue],
+                                  [day intValue]]];
+
       info = [ldifEntry objectForKey: @"calFBURL"];
       if (info)
         [vcard addChildWithTag: @"FBURL"
SOGoContactLDIFEntry.m.diff (5,104 bytes)   
avoegele

avoegele

2011-06-09 14:45

reporter   ~0002556

Last edited: 2011-06-09 14:47

I've attached a patch for "SoObjects/Contacts/SOGoContactLDIFEntry.m", which adds support for the following attributes from https://wiki.mozilla.org/MailNews:Mozilla_LDAP_Address_Book_Schema

facsimileTelephoneNumber (as an alternative to fax),
mozillaSecondEmail,
nsAIMid,
mozillaWorkStreet2,
mozillaWorkUrl,
mozillaHomeStreet,
mozillaHomeStreet2,
mozillaHomeLocalityName,
mozillaHomeState,
mozillaHomePostalCode,
mozillaHomeCountryName,
mozillaHomeUrl

Additionally, the birth date is set if the following attributes, which are exported by recent Thunderbird versions, are set:

birthYear
birthMonth
birthDay

2011-06-09 17:13

 

NGVCard+SOGo.m.diff (2,079 bytes)   
#
# old_revision [d11c3e99fe05eb716e0732c7b5c44019dcd75934]
#
# patch "SoObjects/Contacts/NGVCard+SOGo.m"
#  from [e95f21b95e18be40b86be4a0ca997cd5daf29098]
#    to [b936897a63698300ba8634bb610e31ca31b65dff]
#
============================================================
--- SoObjects/Contacts/NGVCard+SOGo.m	e95f21b95e18be40b86be4a0ca997cd5daf29098
+++ SoObjects/Contacts/NGVCard+SOGo.m	b936897a63698300ba8634bb610e31ca31b65dff
@@ -72,6 +72,14 @@
   if (buffer && [buffer length] > 0)
     [entry setObject: buffer forKey: @"mozillaNickname"];
 
+  buffer = [self title];
+  if (buffer && [buffer length] > 0)
+    [entry setObject: buffer forKey: @"title"];
+
+  buffer = [[self uniqueChildWithTag: @"x-aim"] value: 0];
+  if (buffer && [buffer length] > 0)
+    [entry setObject: buffer forKey: @"nsAIMid"];
+
   marray = [NSMutableArray arrayWithArray: [self childrenWithTag: @"email"]];
   [marray removeObjectsInArray: [self childrenWithTag: @"email"
                  andAttribute: @"type"
@@ -111,7 +119,13 @@
 
   array = [self org];
   if (array && [array count])
-    [entry setObject: [array objectAtIndex: 0] forKey: @"o"];
+    {
+      [entry setObject: [array objectAtIndex: 0] forKey: @"o"];
+      if ([array count] > 1)
+        {
+          [entry setObject: [array objectAtIndex: 1] forKey: @"ou"];
+        }
+    }
 
   array = [self childrenWithTag: @"adr" andAttribute: @"type" havingValue: @"work"];
   if ([array count])
@@ -144,6 +158,18 @@
   if (tmp && [tmp length])
     [entry setObject: tmp forKey: @"description"];
 
+  buffer = [self bday];
+  if (buffer && [buffer length] > 0)
+    {
+      array = [buffer componentsSeparatedByString: @"-"];
+      if ([array count] == 3)
+        {
+          [entry setObject: [array objectAtIndex: 0] forKey: @"birthyear"];
+          [entry setObject: [array objectAtIndex: 1] forKey: @"birthmonth"];
+          [entry setObject: [array objectAtIndex: 2] forKey: @"birthday"];
+        }
+    }
+
   rc = [NSMutableString stringWithString: [entry userRecordAsLDIFEntry]];
   [rc appendFormat: @"\n"];
 
NGVCard+SOGo.m.diff (2,079 bytes)   
avoegele

avoegele

2011-06-09 17:21

reporter   ~0002559

I've attached another patch that adds the following attributes to exported LDIF entries:

title,
nsAIMid,
ou,
birthYear,
birthMonth,
birthDay

BTW, shouldn't the attributes homeStreet, homeurl and workurl be renamed to mozillaHomeStreet, mozillaHomeUrl and mozillaWorkUrl?

Christian Mack

Christian Mack

2012-01-16 16:54

developer   ~0003275

When will this be fixed?

wsourdeau

wsourdeau

2012-01-16 16:55

viewer   ~0003276

Theorically, this should be fixed in SOGo 2.0. Can anybody please give it a try?

ccb23

ccb23

2012-02-04 23:28

reporter   ~0003364

Still no birthday in the LDIFF-Export in Sogo 2.0.0.20120204 (Ubuntu Maverick nightly build)

Issue History

Date Modified Username Field Change
2010-09-20 21:12 Hans New Issue
2010-09-20 22:53 ludovic Note Added: 0001494
2010-09-21 00:46 Hans Note Added: 0001495
2010-09-21 00:47 Hans Note Added: 0001496
2011-06-01 20:56 cameronb Note Added: 0002515
2011-06-09 14:28 avoegele File Added: SOGoContactLDIFEntry.m.diff
2011-06-09 14:45 avoegele Note Added: 0002556
2011-06-09 14:46 avoegele Note Edited: 0002556
2011-06-09 14:47 avoegele Note Edited: 0002556
2011-06-09 17:13 avoegele File Added: NGVCard+SOGo.m.diff
2011-06-09 17:21 avoegele Note Added: 0002559
2012-01-16 16:54 Christian Mack Note Added: 0003275
2012-01-16 16:55 wsourdeau Note Added: 0003276
2012-02-04 23:28 ccb23 Note Added: 0003364