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/6833/head
Bostjan Skufca 8 years ago committed by Aleksander Machniak
parent 802d119153
commit 6fb8da08f3

@ -93,7 +93,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