From d89247fdf3dbbb48333d72c87d48c1cea3197430 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 31 Jul 2018 11:06:38 +0200 Subject: [PATCH] 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. --- api/src/Etemplate/Widget/Url.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/src/Etemplate/Widget/Url.php b/api/src/Etemplate/Widget/Url.php index 1ab67ce4aa..a4eaac9450 100644 --- a/api/src/Etemplate/Widget/Url.php +++ b/api/src/Etemplate/Widget/Url.php @@ -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); }