From 972c9cde16a2aed699ecaf71fa2da946fe49f475 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 5 Jul 2010 12:20:20 +0200 Subject: [PATCH] Have a fixed name format, only with the name parts we actually use for duplicate matching. --- turba/lib/Driver/Sql.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/turba/lib/Driver/Sql.php b/turba/lib/Driver/Sql.php index cefaac820..94e5c5107 100644 --- a/turba/lib/Driver/Sql.php +++ b/turba/lib/Driver/Sql.php @@ -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); -- 2.11.0