From fa50e7985a3f616caa62e05c2eb23af0457a044c Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 5 Sep 2014 12:28:43 +0000 Subject: [PATCH] handle problems in email display and processing for further use --- mail/js/app.js | 16 +++++++++++++--- phpgwapi/inc/common_functions.inc.php | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index b63e5f237c..182ec033d6 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -661,11 +661,21 @@ app.classes.mail = AppJS.extend( content = content[0].split(','); } // Add for current record + var remembervalue = ''; for(var i = 0; i < content.length; i++) { - var value = content[i]; - var email = et2_createWidget('url-email',{id:widget.id+'_'+i, value:value,readonly:true, contact_plus:true},widget); - email.loadingFinished(); + // if there is no @ in string, its most likely that we have a comma in the personal name part of the emailaddress + if (content[i].indexOf('@')<0) + { + remembervalue = content[i]; + } + else + { + var value = remembervalue+(remembervalue?',':'')+content[i]; + var email = et2_createWidget('url-email',{id:widget.id+'_'+i, value:value,readonly:true, contact_plus:true},widget); + email.loadingFinished(); + remembervalue = ''; + } } } else diff --git a/phpgwapi/inc/common_functions.inc.php b/phpgwapi/inc/common_functions.inc.php index 4a78dd2efd..d129f793a9 100755 --- a/phpgwapi/inc/common_functions.inc.php +++ b/phpgwapi/inc/common_functions.inc.php @@ -102,7 +102,7 @@ if (!function_exists('imap_rfc822_parse_adrlist')) foreach(explode(',', $address) as $part) { $trimmed = trim(($pending ? $pending.',' : '').$part); - if ($trimmed[0] == '"' && substr($trimmed, -1) != '>') + if (($trimmed[0] == '"' && substr($trimmed, -1) != '>')||strpos($part, '@')===false) { $pending .= ($pending ? $pending.',' : '').$part; continue;