From a69363961309e46adba5cf5653a38b92af6bccaa Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Sat, 19 Oct 2013 15:51:12 +0200 Subject: Require name or email for sql address book only --- program/lib/Roundcube/rcube_addressbook.php | 6 ------ program/lib/Roundcube/rcube_contacts.php | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'program/lib/Roundcube') diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php index cd347af25..b245ea69d 100644 --- a/program/lib/Roundcube/rcube_addressbook.php +++ b/program/lib/Roundcube/rcube_addressbook.php @@ -223,12 +223,6 @@ abstract class rcube_addressbook } } - // require at least one email address or a name - if ($valid && !strlen($save_data['firstname'].$save_data['surname'].$save_data['name']) && !array_filter($this->get_col_values('email', $save_data, true))) { - $this->set_error(self::ERROR_VALIDATE, 'noemailwarning'); - $valid = false; - } - // allow plugins to do contact validation and auto-fixing $plugin = $rcube->plugins->exec_hook('contact_validate', array( 'record' => $save_data, diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php index 6d01368a1..5c9e5ab39 100644 --- a/program/lib/Roundcube/rcube_contacts.php +++ b/program/lib/Roundcube/rcube_contacts.php @@ -592,8 +592,8 @@ class rcube_contacts extends rcube_addressbook // validate e-mail addresses $valid = parent::validate($save_data, $autofix); - // require at least one e-mail address (syntax check is already done) - if ($valid && !array_filter($this->get_col_values('email', $save_data, true))) { + // require at least one email address or a name + if ($valid && !strlen($save_data['firstname'].$save_data['surname'].$save_data['name']) && !array_filter($this->get_col_values('email', $save_data, true))) { $this->set_error(self::ERROR_VALIDATE, 'noemailwarning'); $valid = false; } -- cgit v1.2.3