<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="http://bugs.horde.org/themes/feed-rss.xsl" type="text/xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 <channel>
  <title>Export to ldif - data has no cn attribute</title>
  <pubDate>Fri, 04 Jul 2008 15:52:40 -0400</pubDate>
  <link>http://bugs.horde.org/ticket/6517</link>
  <atom:link rel="self" type="application/rss+xml" title="Export to ldif - data has no cn attribute" href="http://bugs.horde.org/ticket/6517/rss" />
  <description>Export to ldif - data has no cn attribute</description>

  
  
  <item>
   <title>The exported ldif data has no valid cn attribute. This data,</title>
   <description>The exported ldif data has no valid cn attribute. This data, imported in Mozilla Thunderbird, has no correct display name. Example:

dn: cn=,mail=herbert@linuxhacker.at

should be:

dn: cn=Straub Herbert,mail=herbert@linuxhacker.at

This patch works for me:

--- lib/Data/ldif.php.orig      2008-03-22 13:07:21.000000000 +0100
+++ lib/Data/ldif.php   2008-03-22 13:13:48.000000000 +0100
@@ -182,6 +182,10 @@
             $recordData = '';
             $recordCn = '';
             $recordMail = '';
+            // Straub construct name from firstname and lastname
+           if (!array_key_exists('name', $row)) {
+               $row['name'] = sprintf(&quot;%s %s&quot;, $row['firstname'], $row['lastname']);
+            }
             foreach ($this-&gt;_mozillaAttr as $value) {
                 if (isset($row[$mozillaTurbaMap[$value]])) {
                     // Base64 encode each value as necessary and store it.
</description>
   <pubDate>Sat, 22 Mar 2008 10:27:20 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6517#t44141</link>
  </item>
  <item>
   <title>What about when sources.php has a more complex definition of</title>
   <description>What about when sources.php has a more complex definition of 'name'?  The default definition is:

        'name' =&gt; array('fields' =&gt; array('namePrefix', 'firstname',
                                          'middlenames', 'lastname',
                                          'nameSuffix'),
                        'format' =&gt; '%s %s %s %s %s',
                        'parse' =&gt; array(
                            array('fields' =&gt; array('firstname', 'middlenames',
                                                    'lastname'),
                                  'format' =&gt; '%s %s %s'),
                            array('fields' =&gt; array('firstname', 'lastname'),
                                  'format' =&gt; '%s %s'))),
</description>
   <pubDate>Sun, 23 Mar 2008 03:51:04 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6517#t44156</link>
  </item>
  <item>
   <title>&gt; What about when sources.php has a more complex definition </title>
   <description>&gt; What about when sources.php has a more complex definition of 'name'?  

I saw this definition, but why there is no attribute key 'name' available in the parameter $data of Horde_Data_ldif::exportFile? I used also the lib/tests/ldif_exportFile.phpt testscript. The testdata always containing a 'name' key - my real data not.

In my unterstanding the config/source.php definitions are currently not used in lib/Data/ldif.php and i think, the 'name' attribute should be available before calling 

        $ldif-&gt;exportFile(_(&quot;contacts.ldif&quot;), $data, true);

in data.php. My patch is only a workaround. With this patch, I can see the correct names in Thunderbird with the import Turba addressbook data. I created some screenshots from the imported Horde data in Thunderbird, see

http://www.linuxhacker.at/bugs/all/horde-turba-export-in-ldif

I write the data array to the logfile before i calling exportFile in data.php:

    [15] =&gt; Array
        (
            [firstname] =&gt; Straub
            [lastname] =&gt; Herbert
            [middlenames] =&gt;
            [namePrefix] =&gt;
            [nameSuffix] =&gt;
            [alias] =&gt;
            [birthday] =&gt;
            [homeStreet] =&gt;
            [homePOBox] =&gt;
            [homeCity] =&gt;
            [homeProvince] =&gt;
            [homePostalCode] =&gt;
            [homeCountry] =&gt;
            [workStreet] =&gt;
            [workPOBox] =&gt;
            [workCity] =&gt;
            [workProvince] =&gt;
            [workPostalCode] =&gt;
            [workCountry] =&gt;
            [timezone] =&gt;
            [email] =&gt; herbert@linuxhacker.at
            [homePhone] =&gt;
            [workPhone] =&gt;
            [cellPhone] =&gt;
            [fax] =&gt;
            [pager] =&gt;
            [title] =&gt;
            [role] =&gt;
            [company] =&gt; ,
            [category] =&gt;
            [notes] =&gt; undefined
            [website] =&gt;
            [freebusyUrl] =&gt;
            [pgpPublicKey] =&gt;
            [smimePublicKey] =&gt;
        )

Should the fix be implemented in the export routine or in another place?</description>
   <pubDate>Sun, 23 Mar 2008 08:32:42 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6517#t44162</link>
  </item>
  <item>
   <title>Seems like this is an export bug; composite fields should be</title>
   <description>Seems like this is an export bug; composite fields should be included in the export, right?</description>
   <pubDate>Wed, 23 Apr 2008 23:37:07 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6517#t44856</link>
  </item>
  <item>
   <title>&gt; Seems like this is an export bug; composite fields should </title>
   <description>&gt; Seems like this is an export bug; composite fields should be included 
&gt; in the export, right?

Yes, I think. You can see a full error description on my homepage with screenhots from the Thunderbird Addressbook (with and without patch).

http://www.linuxhacker.at/bugs/all/horde-turba-export-in-ldif</description>
   <pubDate>Thu, 24 Apr 2008 12:31:06 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6517#t44887</link>
  </item>
  <item>
   <title>Fixed in CVS:
http://lists.horde.org/archives/cvs/Week-of-M</title>
   <description>Fixed in CVS:
http://lists.horde.org/archives/cvs/Week-of-Mon-20080421/077793.html</description>
   <pubDate>Sun, 27 Apr 2008 00:28:26 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6517#t44956</link>
  </item>
  

 </channel>
</rss>
