Skip to content

Commit

Permalink
Fix searching for contact details from RI requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Jan 27, 2014
1 parent d502e91 commit 7b7da27
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions framework/Core/lib/Horde/Core/ActiveSync/Connector.php
Expand Up @@ -337,26 +337,32 @@ public function getRecipientCache($max = 100)
*/
public function contacts_search($query, array $options = array())
{
if (!$gal = $this->contacts_getGal()) {
if ((!$gal = $this->contacts_getGal()) && empty($options['recipient_cache_search'])) {
return array();
}

if (!empty($options['recipient_cache_search'])) {
$return_fields = array($gal => array('name', 'alias', 'email'));
$sources = array_keys($this->_registry->contacts->sources(false, true));
$return_fields = array('name', 'alias', 'email');
foreach ($sources as $source) {
$fields[$source] = array('email');
}
} else {
$return_fields = array($gal => array('name', 'alias', 'email', 'firstname', 'lastname',
$sources = array($gal);
$fields = array();
$return_fields = array('name', 'alias', 'email', 'firstname', 'lastname',
'company', 'homePhone', 'workPhone', 'cellPhone', 'title',
'office'));
'office');
}
if (!empty($options['pictures'])) {
$fields[$gal][] = 'photo';
}
$opts = array(
'matchBegin' => true,
'forceSource' => true,
'sources' => array($gal),
'sources' => $sources,
'returnFields' => $return_fields,
'fields' => !empty($options['recipient_cache_search']) ? array('email') : array()
'fields' => $fields
);

return $this->_registry->contacts->search($query, $opts);
Expand Down

0 comments on commit 7b7da27

Please sign in to comment.