Have a fixed name format, only with the name parts we actually use for
authorJan Schneider <jan@horde.org>
Mon, 5 Jul 2010 10:20:20 +0000 (12:20 +0200)
committerJan Schneider <jan@horde.org>
Mon, 5 Jul 2010 10:34:47 +0000 (12:34 +0200)
duplicate matching.

turba/lib/Driver/Sql.php

index cefaac8..94e5c51 100644 (file)
@@ -278,6 +278,10 @@ class Turba_Driver_Sql extends Turba_Driver
         if (isset($this->map['email'])) {
             $fields[] = $this->map['email'];
         }
+        $nameFormat = $GLOBALS['prefs']->getValue('name_format');;
+        if ($nameFormat != 'first_last' && $nameFormat != 'last_first') {
+            $nameFormat = 'first_last';
+        }
 
         $order = $this->_buildFields($fields);
         $joins = $this->_buildJoin($fields);
@@ -316,6 +320,9 @@ class Turba_Driver_Sql extends Turba_Driver
             foreach ($ids as $id) {
                 $contact = $this->getObject($id);
                 $value = $contact->getValue($field);
+                if ($field == 'name') {
+                    $value = Turba::formatName($contact, $nameFormat);
+                }
                 /* HACK! */
                 if ($field == 'email') {
                     $value = Horde_String::lower($value);