Autocomplete search: add id and source (addressbook) into resulting contact data array

Two reasons:
- provide it to plugin backend functions that use 'contacts_autocomplete_after' hook
- provide it to frontend

Why to frontend?
If plugin JS adds an 'autocomplete_insert' hook we need to provide it with exact
autocomplete data. Providing it with name and email address only, without pinpointing
exact origin of this autocomplete result, will severely limit learning capabilities of
potential future autocomplete implementations.
pull/5203/head
Bostjan Skufca 8 years ago
parent a15b2d5998
commit 05c7d49a37

@ -92,7 +92,12 @@ if (!empty($book_types) && strlen($search)) {
// skip duplicates
if (empty($contacts[$index])) {
$contact = array('name' => $contact, 'type' => $sql_arr['_type']);
$contact = array(
'name' => $contact,
'type' => $sql_arr['_type'],
'id' => $sql_arr['contact_id'],
'source' => $abook_id,
);
if (($display = rcube_addressbook::compose_search_name($sql_arr, $email, $name)) && $display != $contact['name']) {
$contact['display'] = $display;

Loading…
Cancel
Save