From 98e00f08d083ef3c0aef0c1ed07f0f792dbd5283 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 11 Oct 2021 18:33:47 +0200 Subject: [PATCH] fix PHP 8.0 TypeError: when exporting multiple users Argument 1 passed to EGroupware\Api\Accounts::username() must be of the type int or null, array given --- timesheet/inc/class.timesheet_ui.inc.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index e7dcd6e836..7ed7ca7c4b 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -660,12 +660,16 @@ class timesheet_ui extends timesheet_bo unset($query['col_filter']['cat_id']); } $GLOBALS['egw_info']['flags']['app_header'] = lang('timesheet'); - if ($query['col_filter']['ts_owner']) + if (!empty($query['col_filter']['ts_owner'])) { - $GLOBALS['egw_info']['flags']['app_header'] .= ': '.Api\Accounts::username($query['col_filter']['ts_owner']); - #if ($GLOBALS['egw']->accounts->get_type($query['col_filter']['ts_owner']) == 'g') $GLOBALS['egw_info']['flags']['app_header'] .= ' '. lang("and its members"); - #_debug_array($GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true)); - if ($query['col_filter']['ts_owner']<0) $query['col_filter']['ts_owner'] = array_merge(array($query['col_filter']['ts_owner']),$GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true)); + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.implode(', ', + array_map(Api\Accounts::class.'::username', (array)$query['col_filter']['ts_owner'])); + + if ($query['col_filter']['ts_owner'] < 0) + { + $query['col_filter']['ts_owner'] = array_merge(array($query['col_filter']['ts_owner']), + $GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true)); + } } else {