Summary | Export to ldif - data has no cn attribute |
Queue | Turba |
Queue Version | 2.2-RC3 |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | chuck (at) horde (dot) org |
Requester | herbert (at) linuxhacker (dot) at |
Created | 03/22/2008 (6327 days ago) |
Due | |
Updated | 04/27/2008 (6291 days ago) |
Assigned | 04/24/2008 (6294 days ago) |
Resolved | 04/27/2008 (6291 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
Assigned to Chuck Hagenbuch
State ⇒ Resolved
http://lists.horde.org/archives/cvs/Week-of-Mon-20080421/077793.html
in the export, right?
screenhots from the Thunderbird Addressbook (with and without patch).
http://www.linuxhacker.at/bugs/all/horde-turba-export-in-ldif
State ⇒ Feedback
in the export, right?
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->exportFile(_("contacts.ldif"), $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] => Array
(
[firstname] => Straub
[lastname] => Herbert
[middlenames] =>
[namePrefix] =>
[nameSuffix] =>
[alias] =>
[birthday] =>
[homeStreet] =>
[homePOBox] =>
[homeCity] =>
[homeProvince] =>
[homePostalCode] =>
[homeCountry] =>
[workStreet] =>
[workPOBox] =>
[workCity] =>
[workProvince] =>
[workPostalCode] =>
[workCountry] =>
[timezone] =>
[email] => herbert@linuxhacker.at
[homePhone] =>
[workPhone] =>
[cellPhone] =>
[fax] =>
[pager] =>
[title] =>
[role] =>
[company] => ,
[category] =>
[notes] => undefined
[website] =>
[freebusyUrl] =>
[pgpPublicKey] =>
[smimePublicKey] =>
)
Should the fix be implemented in the export routine or in another place?
The default definition is:
'name' => array('fields' => array('namePrefix', 'firstname',
'middlenames', 'lastname',
'nameSuffix'),
'format' => '%s %s %s %s %s',
'parse' => array(
array('fields' => array('firstname',
'middlenames',
'lastname'),
'format' => '%s %s %s'),
array('fields' => array('firstname', 'lastname'),
'format' => '%s %s'))),
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Export to ldif - data has no cn attribute
Queue ⇒ Turba
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
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("%s %s", $row['firstname'],
$row['lastname']);
+ }
foreach ($this->_mozillaAttr as $value) {
if (isset($row[$mozillaTurbaMap[$value]])) {
// Base64 encode each value as necessary and store it.