MFB:
authorJan Schneider <jan@horde.org>
Tue, 21 Sep 2010 21:37:59 +0000 (23:37 +0200)
committerJan Schneider <jan@horde.org>
Tue, 21 Sep 2010 21:37:59 +0000 (23:37 +0200)
  [jan] Correctly export FN vCard property if 'alternative_name' is set, but not
  'name' (Bug #9207).
  Fix charset conversion.

turba/docs/CHANGES
turba/lib/Driver.php

index 1491b20..aef9a1b 100644 (file)
@@ -14,6 +14,8 @@ v3.0-git
 v2.3.5-cvs
 ----------
 
+[jan] Correctly export FN vCard property if 'alternative_name' is set, but not
+      'name' (Bug #9207).
 [jan] Fix import of addresses from LDIF (Axel Jurak, Bug #9215).
 [jan] Speed up browsing of long address books.
 
index cb44250..0d04120 100644 (file)
@@ -1650,14 +1650,17 @@ class Turba_Driver implements Countable
         }
 
         if (!$formattedname && (!$fields || isset($fields['FN']))) {
-            if (!empty($this->alternativeName) &&
+            if ($object->getValue('name')) {
+                $val = $object->getValue('name');
+            } elseif (!empty($this->alternativeName) &&
                 isset($hash[$this->alternativeName])) {
                 $val = $hash[$this->alternativeName];
-            } elseif (isset($hash['lastname'])) {
-                $val = empty($hash['firstname']) ? $hash['lastname'] : $hash['firstname'] . ' ' . $hash['lastname'];
             } else {
                 $val = '';
             }
+            if ($version != '2.1') {
+                $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+            }
             $vcard->setAttribute('FN', $val, Horde_Mime::is8bit($val) ? $charset : array());
         }