From e848180aaa9640de871796ca1a3e4f8110701fd6 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 12 May 2011 16:18:19 -0400
Subject: [PATCH] Improve display name composition when saving contacts (#1487143), with plugin-support; allow empty names in sql address book, fall back to e-mail address in listing and vcard export
---
program/include/rcube_ldap.php | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index d9f5a10..f166fd2 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -610,6 +610,26 @@
/**
+ * Check the given data before saving.
+ * If input not valid, the message to display can be fetched using get_error()
+ *
+ * @param array Assoziative array with data to save
+ * @return boolean True if input is valid, False if not.
+ */
+ public function validate($save_data)
+ {
+ // check for name input
+ if (empty($save_data['name'])) {
+ $this->set_error('warning', 'nonamewarning');
+ return false;
+ }
+
+ // validate e-mail addresses
+ return parent::validate($save_data);
+ }
+
+
+ /**
* Create a new contact record
*
* @param array Hash array with save data
--
Gitblit v1.9.1