6.0.0-beta1
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
11/6/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#10681] Autocompleter in IMP with inconsistent results
*
Your Email Address
*
Spam protection
Enter the letters below:
. ..__ . __ . . |\/|| \| / `| | | ||__/|___\__.|__|
Comment
>> Are you sure the hook is running and returning the proper data? > > Good hint, I didn't thought about, whether it's returning proper > data, because it was provided in hooks.dist. > > I found out, why I got different results. > > When the search_fields-pref was set by the hook, it contained ALL > fields, not just the fields, marked to be searched in turba's > backends.php. This lead to too many results, which is why the results > were not being displayed (max. 100). > > I expanded the hooks, to filter for that. > > Maybe it could be added to the dist? > > > This is my complete prefs_init-Hook: > > public function prefs_init($pref, $value, $username, $scope_ob) > { > switch ($pref) { > case 'add_source': > // Dynamically set the add_source preference. > > // Example: Useful hook when using a Turba source with shares > // enabled (i.e. the example localsql configuration). > $value=is_null($username) > ? $value > : $GLOBALS['registry']->call('contacts/getDefaultShare'); > > # return $value; > break; > > case 'search_fields': > case 'search_sources': > // Dynamically set the search_fields/search_sources preferences. > > // Example #1: Use the list of sources defined in the contacts > // application (e.g. Turba). > > if (!is_null($username) && > $GLOBALS['registry']->hasMethod('contacts/sources')) { > $sources = $GLOBALS['registry']->call('contacts/sources'); > if ($pref == 'search_fields') { > $out = array(); > foreach (array_keys($sources) as $source) { > > # $out[$source] = > array_keys($GLOBALS['registry']->call('contacts/fields', > array($source))); > > #reduce to searchable fields > $all_fields = > ($GLOBALS['registry']->call('contacts/fields', array($source))); > foreach($all_fields as $field=>$details) { > if($details['search']==true) > $out[$source][]=$field; > > } > > } > } else { > $out = array_keys($sources); > } > > $value=json_encode($out); > } > break; > } > return $value; > } > > > This was added to the foreach: > > #reduce to searchable fields > $all_fields = > ($GLOBALS['registry']->call('contacts/fields', array($source))); > foreach($all_fields as $field=>$details) { > if($details['search']==true) > $out[$source][]=$field; > > > > Thanks for advice, can be closed.
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers