Require name or email for sql address book only
| | |
| | | } |
| | | } |
| | | |
| | | // 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, |
| | |
| | | // 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; |
| | | } |