From ecfaed571b2c38f4bcc2b6a0fa39fba15a5126ce Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 11 Nov 2011 10:04:45 -0500
Subject: [PATCH] - Apply fixes fom trunk up to r5414

---
 program/steps/addressbook/import.inc |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc
index 12a8d6b..63a6dae 100644
--- a/program/steps/addressbook/import.inc
+++ b/program/steps/addressbook/import.inc
@@ -138,7 +138,10 @@
   $CONTACTS = $RCMAIL->get_address_book($target, true);
 
   // let rcube_vcard do the hard work :-)
-  $vcards = rcube_vcard::import(file_get_contents($_FILES['_file']['tmp_name']));
+  $vcard_o = new rcube_vcard();
+  $vcard_o->extend_fieldmap($CONTACTS->vcard_map);
+
+  $vcards = $vcard_o->import(file_get_contents($_FILES['_file']['tmp_name']));
 
   // no vcards detected
   if (!count($vcards)) {
@@ -171,9 +174,9 @@
 
       if (!$replace && $email) {
         // compare e-mail address
-        $existing = $CONTACTS->search('email', $email, false, false);
+        $existing = $CONTACTS->search('email', $email, 1, false);
         if (!$existing->count && $vcard->displayname) {  // compare display name
-          $existing = $CONTACTS->search('name', $vcard->displayname, false, false);
+          $existing = $CONTACTS->search('name', $vcard->displayname, 1, false);
         }
         if ($existing->count) {
           $IMPORT_STATS->skipped++;

--
Gitblit v1.9.1