From 59478e06c25303a790a0840ab2ac30662c4ef781 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 5 Aug 2014 16:46:22 +0200 Subject: c'est la merde.. --- program/steps/addressbook/copy.inc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'program/steps/addressbook/copy.inc') diff --git a/program/steps/addressbook/copy.inc b/program/steps/addressbook/copy.inc index d4387194a..480a9b52e 100644 --- a/program/steps/addressbook/copy.inc +++ b/program/steps/addressbook/copy.inc @@ -57,16 +57,10 @@ foreach ($cids as $source => $cid) foreach ($cid as $cid) { $a_record = $CONTACTS->get_record($cid, true); - // avoid copying groups - if ($a_record['_type'] == 'group') - continue; - // Check if contact exists, if so, we'll need it's ID // Note: Some addressbooks allows empty email address field - // @TODO: should we check all email addresses? - $email = $CONTACTS->get_col_values('email', $a_record, true); - if (!empty($email)) - $result = $TARGET->search('email', $email[0], 1, true, true); + if (!empty($a_record['email'])) + $result = $TARGET->search('email', $a_record['email'], 1, true, true); else if (!empty($a_record['name'])) $result = $TARGET->search('name', $a_record['name'], 1, true, true); else @@ -120,7 +114,7 @@ foreach ($cids as $source => $cid) } } -if (!$success) +if ($success == 0) $OUTPUT->show_message($errormsg, 'error'); else $OUTPUT->show_message('copysuccess', 'notice', array('nr' => $success)); -- cgit v1.2.3