mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 09:23:28 +01:00
* Mail- List mailing lists before contacts when searching for email addresses
This commit is contained in:
parent
eba4ce0549
commit
a14a8681fc
@ -3392,6 +3392,32 @@ class mail_compose
|
||||
$include_lists = (boolean)$_REQUEST['include_lists'];
|
||||
|
||||
$contacts_obj = new Api\Contacts();
|
||||
$results = array();
|
||||
|
||||
// Add up to 5 matching mailing lists
|
||||
if($include_lists)
|
||||
{
|
||||
$lists = array_filter(
|
||||
$contacts_obj->get_lists(Acl::READ),
|
||||
function($element) use($_searchString) {
|
||||
return (stripos($element, $_searchString) !== false);
|
||||
}
|
||||
);
|
||||
$list_count = 0;
|
||||
foreach($lists as $key => $list_name)
|
||||
{
|
||||
$results[] = array(
|
||||
'id' => $key,
|
||||
'name' => $list_name,
|
||||
'label' => $list_name,
|
||||
'class' => 'mailinglist',
|
||||
'title' => lang('Mailinglist'),
|
||||
'data' => $key
|
||||
);
|
||||
if($list_count++ > 5) break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($GLOBALS['egw_info']['user']['apps']['addressbook'] && strlen($_searchString)>=$_searchStringLength)
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.array2string($_searchString));
|
||||
@ -3428,7 +3454,7 @@ class mail_compose
|
||||
unset($accounts);
|
||||
}
|
||||
}
|
||||
$results = array();
|
||||
|
||||
if(is_array($contacts)) {
|
||||
foreach($contacts as $contact) {
|
||||
foreach(array($contact['email'],$contact['email_home']) as $email) {
|
||||
@ -3489,29 +3515,6 @@ class mail_compose
|
||||
);
|
||||
}
|
||||
|
||||
// Add up to 5 matching mailing lists
|
||||
if($include_lists)
|
||||
{
|
||||
$lists = array_filter(
|
||||
$contacts_obj->get_lists(Acl::READ),
|
||||
function($element) use($_searchString) {
|
||||
return (stripos($element, $_searchString) !== false);
|
||||
}
|
||||
);
|
||||
$list_count = 0;
|
||||
foreach($lists as $key => $list_name)
|
||||
{
|
||||
$results[] = array(
|
||||
'id' => $key,
|
||||
'name' => $list_name,
|
||||
'label' => $list_name,
|
||||
'class' => 'mailinglist',
|
||||
'title' => lang('Mailinglist'),
|
||||
'data' => $key
|
||||
);
|
||||
if($list_count++ > 5) break;
|
||||
}
|
||||
}
|
||||
// switch regular JSON response handling off
|
||||
Api\Json\Request::isJSONRequest(false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user