diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2012-09-17 22:04:16 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2012-09-17 22:04:16 +0200 |
commit | 8f098e8dead85b6512ac72b2d805314baec72a2f (patch) | |
tree | 96b89dbcc2a58dab0f2dd1183beef3036c13287f /program/steps/addressbook | |
parent | 99d9f50a0000447d0a752e6c43716237dc0da176 (diff) | |
parent | 6898b420ed4eb2bd2d1933758cde27bdd305d72a (diff) |
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r-- | program/steps/addressbook/edit.inc | 3 | ||||
-rw-r--r-- | program/steps/addressbook/import.inc | 22 | ||||
-rw-r--r-- | program/steps/addressbook/save.inc | 1 |
3 files changed, 13 insertions, 13 deletions
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc index 0f1fd6697..90069a7eb 100644 --- a/program/steps/addressbook/edit.inc +++ b/program/steps/addressbook/edit.inc @@ -117,9 +117,6 @@ function rcmail_contact_editform($attrib) $record = rcmail_get_edit_record(); - // add some labels to client - $RCMAIL->output->add_label('noemailwarning', 'nonamewarning'); - // copy (parsed) address template to client if (preg_match_all('/\{([a-z0-9]+)\}([^{]*)/i', $RCMAIL->config->get('address_template', ''), $templ, PREG_SET_ORDER)) $RCMAIL->output->set_env('address_template', $templ); diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc index 654a33602..15e04b82a 100644 --- a/program/steps/addressbook/import.inc +++ b/program/steps/addressbook/import.inc @@ -189,32 +189,36 @@ if (is_array($_FILES['_file'])) { $IMPORT_STATS->names = array(); $IMPORT_STATS->skipped_names = array(); $IMPORT_STATS->count = count($vcards); - $IMPORT_STATS->inserted = $IMPORT_STATS->skipped = $IMPORT_STATS->nomail = $IMPORT_STATS->errors = 0; + $IMPORT_STATS->inserted = $IMPORT_STATS->skipped = $IMPORT_STATS->invalid = $IMPORT_STATS->errors = 0; if ($replace) { $CONTACTS->delete_all(); } foreach ($vcards as $vcard) { - $email = $vcard->email[0]; $a_record = $vcard->get_assoc(); - // skip entries without an e-mail address or invalid - if (empty($email) || !$CONTACTS->validate($a_record, true)) { - $IMPORT_STATS->nomail++; + // skip invalid (incomplete) entries + if (!$CONTACTS->validate($a_record, true)) { + $IMPORT_STATS->invalid++; continue; } // We're using UTF8 internally + $email = $vcard->email[0]; $email = rcube_idn_to_utf8($email); - if (!$replace && $email) { + if (!$replace) { + $existing = null; // compare e-mail address - $existing = $CONTACTS->search('email', $email, 1, false); - if (!$existing->count && $vcard->displayname) { // compare display name + if ($email) { + $existing = $CONTACTS->search('email', $email, 1, false); + } + // compare display name if email not found + if ((!$existing || !$existing->count) && $vcard->displayname) { $existing = $CONTACTS->search('name', $vcard->displayname, 1, false); } - if ($existing->count) { + if ($existing && $existing->count) { $IMPORT_STATS->skipped++; $IMPORT_STATS->skipped_names[] = $vcard->displayname ? $vcard->displayname : $email; continue; diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc index 3bfce3b4d..887e49827 100644 --- a/program/steps/addressbook/save.inc +++ b/program/steps/addressbook/save.inc @@ -161,7 +161,6 @@ else { $source = $orig_source; // show notice if existing contacts with same e-mail are found - $existing = false; foreach ($CONTACTS->get_col_values('email', $a_record, true) as $email) { if ($email && ($res = $CONTACTS->search('email', $email, 1, false, true)) && $res->count) { $OUTPUT->show_message('contactexists', 'notice', null, false); |