From 9336ba21cfdee9aca3898361a62b42a6027242df Mon Sep 17 00:00:00 2001 From: alecpl Date: Thu, 12 Apr 2012 11:52:09 +0000 Subject: - Fix importing to LDAP addressbook when mail attribute is required by validating input data with autofix --- program/steps/addressbook/import.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'program/steps/addressbook/import.inc') diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc index 7b52bdcee..018c980eb 100644 --- a/program/steps/addressbook/import.inc +++ b/program/steps/addressbook/import.inc @@ -164,10 +164,11 @@ if ($_FILES['_file']['tmp_name'] && is_uploaded_file($_FILES['_file']['tmp_name' $CONTACTS->delete_all(); foreach ($vcards as $vcard) { - $email = $vcard->email[0]; + $email = $vcard->email[0]; + $a_record = $vcard->get_assoc(); - // skip entries without an e-mail address - if (empty($email)) { + // skip entries without an e-mail address or invalid + if (empty($email) || !$CONTACTS->validate($a_record, true)) { $IMPORT_STATS->nomail++; continue; } @@ -188,7 +189,6 @@ if ($_FILES['_file']['tmp_name'] && is_uploaded_file($_FILES['_file']['tmp_name' } } - $a_record = $vcard->get_assoc(); $a_record['vcard'] = $vcard->export(); $plugin = $RCMAIL->plugins->exec_hook('contact_create', array('record' => $a_record, 'source' => null)); -- cgit v1.2.3