mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-24 23:08:53 +01:00
* Mail: take user's cutomfields type of email into account when searching for contacts in Compose -> TO field.
This commit is contained in:
parent
3dd671ad8d
commit
a059628f58
@ -502,6 +502,28 @@ class Customfields implements \IteratorAggregate
|
|||||||
return $types;
|
return $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return names of custom fields containing url-email
|
||||||
|
*
|
||||||
|
* @param string $app
|
||||||
|
* @return array of url-email fields
|
||||||
|
*/
|
||||||
|
public static function get_email_cfs($app)
|
||||||
|
{
|
||||||
|
$fields = array();
|
||||||
|
if (($cfs = self::get($app, true)))
|
||||||
|
{
|
||||||
|
foreach($cfs as $name => $data)
|
||||||
|
{
|
||||||
|
if ($data['type'] == 'url-email')
|
||||||
|
{
|
||||||
|
$fields[] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise our db
|
* Initialise our db
|
||||||
*
|
*
|
||||||
|
@ -3592,6 +3592,7 @@ class mail_compose
|
|||||||
$filter['cols_to_search'] = array('n_prefix','n_given','n_family','org_name','email','email_home', 'contact_id', 'etag');
|
$filter['cols_to_search'] = array('n_prefix','n_given','n_family','org_name','email','email_home', 'contact_id', 'etag');
|
||||||
$cols = array('n_fn','n_prefix','n_given','n_family','org_name','email','email_home', 'contact_id', 'etag');
|
$cols = array('n_fn','n_prefix','n_given','n_family','org_name','email','email_home', 'contact_id', 'etag');
|
||||||
$contacts = $contacts_obj->search($search_str, $cols, 'n_fn', '', '%', false, 'OR', array(0,100), $filter);
|
$contacts = $contacts_obj->search($search_str, $cols, 'n_fn', '', '%', false, 'OR', array(0,100), $filter);
|
||||||
|
$cfs_type_email = Api\Storage\Customfields::get_email_cfs('addressbook');
|
||||||
// additionally search the accounts, if the contact storage is not the account storage
|
// additionally search the accounts, if the contact storage is not the account storage
|
||||||
if ($showAccounts && $contacts_obj->so_accounts)
|
if ($showAccounts && $contacts_obj->so_accounts)
|
||||||
{
|
{
|
||||||
@ -3616,7 +3617,8 @@ class mail_compose
|
|||||||
|
|
||||||
if(is_array($contacts)) {
|
if(is_array($contacts)) {
|
||||||
foreach($contacts as $contact) {
|
foreach($contacts as $contact) {
|
||||||
foreach(array($contact['email'],$contact['email_home']) as $email) {
|
$cf_emails = (array)array_values(array_values($contacts_obj->read_customfields($contact['id'], $cfs_type_email))[0]);
|
||||||
|
foreach(array_merge(array($contact['email'],$contact['email_home']), $cf_emails) as $email) {
|
||||||
// avoid wrong addresses, if an rfc822 encoded address is in addressbook
|
// avoid wrong addresses, if an rfc822 encoded address is in addressbook
|
||||||
//$email = preg_replace("/(^.*<)([a-zA-Z0-9_\-]+@[a-zA-Z0-9_\-\.]+)(.*)/",'$2',$email);
|
//$email = preg_replace("/(^.*<)([a-zA-Z0-9_\-]+@[a-zA-Z0-9_\-\.]+)(.*)/",'$2',$email);
|
||||||
$rfcAddr = Mail::parseAddressList($email);
|
$rfcAddr = Mail::parseAddressList($email);
|
||||||
|
Loading…
Reference in New Issue
Block a user