From 39cafac3f5e9cff676b379c1ecb1c847eec558e2 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 07 Oct 2011 07:07:23 -0400
Subject: [PATCH] Autocomplete LDAP records when adding contacts from mail (#1488073)

---
 program/steps/mail/addcontact.inc |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index b74d95f..dafb276 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -60,6 +60,16 @@
     $contact['email'] = rcube_idn_to_utf8($contact['email']);
     $contact['name'] = rcube_addressbook::compose_display_name($contact);
 
+    // validate contact record
+    if (!$CONTACTS->validate($contact, true)) {
+      $error = $CONTACTS->get_error();
+      // TODO: show dialog to complete record
+      // if ($error['type'] == rcube_addressbook::ERROR_VALIDATE) { }
+      
+      $OUTPUT->show_message($error['message'] ? $error['message'] : 'errorsavingcontact', 'error');
+      $OUTPUT->send();
+    }
+
     // check for existing contacts
     $existing = $CONTACTS->search('email', $contact['email'], true, false);
 

--
Gitblit v1.9.1