Strip RFC822 email to avoid search contacts other than email itself. Fix issue sometimes add as new contact not showing up because it takes it as existing contact.

This commit is contained in:
Hadi Nategh 2018-07-31 11:06:38 +02:00
parent 5864f869d7
commit b2b285848e

View File

@ -132,11 +132,12 @@ class Url extends Etemplate\Widget
/**
* Handle ajax searches for existing contact based on email
*
* @return boolean email exists or not
* @return boolean $_email exists or not
*/
public static function ajax_contact($email)
public static function ajax_contact($_email)
{
$result = $GLOBALS['egw']->contacts->search($email);
$email = \EGroupware\Api\Mail::stripRFC822Addresses(array($_email));
$result = $GLOBALS['egw']->contacts->search($email[0]);
\EGroupware\Api\Json\Response::data($result ? true : false);
}