fix for function identity_name to use the same logic on missing identity values (like ident_realname and ident_email) as iterator on identities; if no ident_email is present use the users email-address, if still empty use acc_imap_username if it passes a simple test on qualifying as email address

This commit is contained in:
Klaus Leithoff 2015-03-20 11:07:53 +00:00
parent caa1f2247d
commit 7493c69ece
2 changed files with 9 additions and 3 deletions

View File

@ -1498,7 +1498,13 @@ class emailadmin_account implements ArrayAccess
$account = array_merge($account, emailadmin_credentials::from_session($account));
}
}
if (empty($account['ident_email']) && !empty($account['acc_imap_username']))
// fill an empty ident_realname or ident_email of current user with data from user account
if ($replace_placeholders && (!isset($account_id) || $account_id == $GLOBALS['egw_info']['user']['acount_id']))
{
if (empty($account['ident_realname'])) $account['ident_realname'] = $GLOBALS['egw_info']['user']['account_fullname'];
if (empty($account['ident_email'])) $account['ident_email'] = $GLOBALS['egw_info']['user']['account_email'];
}
if (empty($account['ident_email']) && !empty($account['acc_imap_username']) && strpos($account['acc_imap_username'], '@') !== false)
{
$account['ident_email'] = $account['acc_imap_username'];
}

View File

@ -807,7 +807,7 @@ class mail_ui
// not to be used for IMAP Foldertree, as there is no Imap host
continue;
}
$identity_name = emailadmin_account::identity_name($accountObj);
$identity_name = emailadmin_account::identity_name($accountObj,true,$GLOBALS['egw_info']['user']['acount_id']);
$oA = array('id' => $acc_id,
'text' => str_replace(array('<','>'),array('[',']'),$identity_name),// as angle brackets are quoted, display in Javascript messages when used is ugly, so use square brackets instead
'tooltip' => '('.$acc_id.') '.htmlspecialchars_decode($identity_name),
@ -1069,7 +1069,7 @@ class mail_ui
// not to be used for IMAP Foldertree, as there is no Imap host
continue;
}
$identity_name = emailadmin_account::identity_name($accountObj);
$identity_name = emailadmin_account::identity_name($accountObj,true,$GLOBALS['egw_info']['user']['acount_id']);
$accArray[$acc_id] = str_replace(array('<','>'),array('[',']'),$identity_name);// as angle brackets are quoted, display in Javascript messages when used is ugly, so use square brackets instead
}
}