fix TypeError: Argument 1 passed to EGroupware\Api\Accounts::username() must be of the type int, null given

This commit is contained in:
Ralf Becker 2021-10-07 16:53:33 +02:00
parent 088dab168c
commit a599f9390c

View File

@ -595,11 +595,15 @@ class Accounts
/**
* Return formatted username for a given account_id
*
* @param int $account_id account id
* @param ?int $account_id account id, default current user
* @return string full name of user or "#$account_id" if user not found
*/
static function username(int $account_id)
static function username(int $account_id=null)
{
if (empty($account_id))
{
$account_id = $GLOBALS['egw_info']['user']['account_id'];
}
if (!($account = self::cache_read($account_id)))
{
return '#'.$account_id;