summaryrefslogtreecommitdiff
path: root/program/steps/addressbook/import.inc
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-24 18:00:17 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-24 18:01:29 +0100
commitae0821f1dd15baacd436d3337eb26a41d72204d0 (patch)
treebf0fafb4964c5e3c110d99f7b846fe163ee62152 /program/steps/addressbook/import.inc
parent1f8fbf945526f0fdeae5e291133acf6b77f7356b (diff)
Be less restrictive on vCard import, do not require FN when N exists
Diffstat (limited to 'program/steps/addressbook/import.inc')
-rw-r--r--program/steps/addressbook/import.inc11
1 files changed, 10 insertions, 1 deletions
diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc
index df07d64bc..72da15078 100644
--- a/program/steps/addressbook/import.inc
+++ b/program/steps/addressbook/import.inc
@@ -209,6 +209,15 @@ if (is_array($_FILES['_file'])) {
foreach ($vcards as $vcard) {
$a_record = $vcard->get_assoc();
+ // Generate contact's display name (must be before validation), the same we do in save.inc
+ if (empty($a_record['name'])) {
+ $a_record['name'] = rcube_addressbook::compose_display_name($a_record, true);
+ // Reset it if equals to email address (from compose_display_name())
+ if ($a_record['name'] == $a_record['email'][0]) {
+ $a_record['name'] = '';
+ }
+ }
+
// skip invalid (incomplete) entries
if (!$CONTACTS->validate($a_record, true)) {
$IMPORT_STATS->invalid++;
@@ -250,7 +259,7 @@ if (is_array($_FILES['_file'])) {
if ($success) {
$IMPORT_STATS->inserted++;
- $IMPORT_STATS->names[] = $vcard->displayname ? $vcard->displayname : $email;
+ $IMPORT_STATS->names[] = $a_record['name'] ? $a_record['name'] : $email;
}
else {
$IMPORT_STATS->errors++;