From 1d743830c966f3491f579173308b85bae3a9d74b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 13 Aug 2012 14:26:00 +0000 Subject: [PATCH] need to allow account_lid string as parameter for accounts::id2name(), it is used in many places --- phpgwapi/inc/class.accounts.inc.php | 6 +++++- phpgwapi/inc/class.accounts_ldap.inc.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.accounts.inc.php b/phpgwapi/inc/class.accounts.inc.php index bffc2ea755..b17b90db7c 100644 --- a/phpgwapi/inc/class.accounts.inc.php +++ b/phpgwapi/inc/class.accounts.inc.php @@ -591,12 +591,16 @@ class accounts * * Uses the read method to fetch all data. * - * @param int $account_id numerica account_id + * @param int|string $account_id numeric account_id or account_lid * @param string $which='account_lid' type to convert to: account_lid (default), account_email, ... * @return string|boolean converted value or false on error ($account_id not found) */ static function id2name($account_id, $which='account_lid') { + if (!is_numeric($account_id) && !($account_id = self::getInstance()->name2id($account_id))) + { + return false; + } try { if (!($data = self::cache_read($account_id))) return false; } diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index a593f9bce6..4e3ab561bb 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -285,7 +285,7 @@ class accounts_ldap if (!$members) $members = $this->members($data['account_id']); $to_write[$forward] = array(); - foreach ($members as $member) + foreach ($members as $member => $account_lid) { if (($email = $this->id2name($member,'account_email'))) {