diff --git a/phpgwapi/inc/class.accounts.inc.php b/phpgwapi/inc/class.accounts.inc.php index 32e5a7e934..d2ccb71eaf 100644 --- a/phpgwapi/inc/class.accounts.inc.php +++ b/phpgwapi/inc/class.accounts.inc.php @@ -774,6 +774,9 @@ return $account_name[$account_id] !== False; } $Ok = accounts_::get_account_name($accountid,$lid,$fname,$lname); + + if (empty($fname)) $fname = $lid; + if (empty($lname)) $lname = $this->get_type($accountid) == 'g' ? lang('Group') : lang('user'); $account_name[$account_id] = array( 'lid' => $lid, diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index d3296e77a0..60401dd625 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -481,11 +481,12 @@ /** * return the fullname of a user * - * @param $lid account loginid - * @param $firstname firstname - * @param $lastname lastname + * @param $lid='' account loginid + * @param $firstname='' firstname + * @param $lastname='' lastname + * @param $accountid=0 id, to check if it's a user or group, otherwise the lid will be used */ - function display_fullname($lid = '', $firstname = '', $lastname = '') + function display_fullname($lid = '', $firstname = '', $lastname = '',$accountid=0) { if (! $lid && ! $firstname && ! $lastname) { @@ -494,6 +495,12 @@ $lastname = $GLOBALS['egw_info']['user']['lastname']; } + if (empty($firstname)) $firstname = $lid; + if (empty($lastname)) + { + $lastname = $GLOBALS['egw']->accounts->get_type($accountid ? $accountid : $lid) == 'g' ? + lang('Group') : lang('User'); + } $display = $GLOBALS['egw_info']['user']['preferences']['common']['account_display']; if ($firstname && $lastname) @@ -539,7 +546,8 @@ function grab_owner_name($accountid = '') { $GLOBALS['egw']->accounts->get_account_name($accountid,$lid,$fname,$lname); - return $this->display_fullname($lid,$fname,$lname); + + return $this->display_fullname($lid,$fname,$lname,$accountid); } /**