Allow multiple records with same e-mail address but show notice to the user

release-0.6
thomascube 14 years ago
parent 6b07e62c7e
commit b8f14ce744

@ -204,22 +204,15 @@ if (!empty($cid))
// insert a new contact // insert a new contact
else { else {
// check for existing contacts // show notice if existing contacts with same e-mail are found
$existing = false; $existing = false;
foreach ($CONTACTS->get_col_values('email', $a_record, true) as $email) { foreach ($CONTACTS->get_col_values('email', $a_record, true) as $email) {
if (($res = $CONTACTS->search('email', $email, true, false)) && $res->count) { if (($res = $CONTACTS->search('email', $email, false, false)) && $res->count) {
$existing = true; $OUTPUT->show_message('contactexists', 'notice', null, false);
break; break;
} }
} }
// show warning message
if ($existing) {
$OUTPUT->show_message('contactexists', 'warning', null, false);
rcmail_overwrite_action('add');
return;
}
$plugin = $RCMAIL->plugins->exec_hook('contact_create', array( $plugin = $RCMAIL->plugins->exec_hook('contact_create', array(
'record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 'record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC)));
$a_record = $plugin['record']; $a_record = $plugin['record'];

Loading…
Cancel
Save