mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Improve contact search
This commit is contained in:
parent
b5fc9669df
commit
45806cda7d
@ -131,6 +131,21 @@ class Contact extends EntityModel implements AuthenticatableContract, CanResetPa
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function getSearchName()
|
||||
{
|
||||
$name = $this->getFullName();
|
||||
$email = $this->email;
|
||||
|
||||
if ($name && $email) {
|
||||
return sprintf('%s <%s>', $name, $email);
|
||||
} else {
|
||||
return $name ?: $email;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $contact_key
|
||||
*
|
||||
|
@ -193,7 +193,7 @@ class AccountRepository
|
||||
|
||||
foreach ($client->contacts as $contact) {
|
||||
$data['contacts'][] = [
|
||||
'value' => $contact->getDisplayName(),
|
||||
'value' => $contact->getSearchName(),
|
||||
'tokens' => implode(',', [$contact->first_name, $contact->last_name, $contact->email, $contact->phone]),
|
||||
'url' => $client->present()->url,
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user