From e5a6f195dcd90f8115d584b48106a5d6c6f1dadb Mon Sep 17 00:00:00 2001 From: ralf Date: Tue, 15 Mar 2022 10:50:57 +0200 Subject: [PATCH] fix delete-account did not show 0 entries for InfoLog, also give a total per InfoLog type --- admin/inc/class.admin_account.inc.php | 8 ++++++-- api/src/Accounts.php | 11 +++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/admin/inc/class.admin_account.inc.php b/admin/inc/class.admin_account.inc.php index f5aae79150..affcf86f65 100644 --- a/admin/inc/class.admin_account.inc.php +++ b/admin/inc/class.admin_account.inc.php @@ -376,7 +376,11 @@ class admin_account $content['delete_apps'][] = $app; $sel_options['delete_apps'][] = array( 'value' => $app, - 'label' => lang($app) . (is_array($counts) ? (': ' . $counts['total'] . ' ' . $entry) : '') + 'label' => lang($app) . (is_array($counts) ? (': ' . $counts['total'] . ' ' . $entry. + (count($counts) > 1 ? ' ('.implode(', ', array_map(static function($type) use ($counts) + { + return $type.': '.$counts[$type]; + }, array_diff(array_keys($counts), ['total']))).')' : '')) : '') ); } else if (is_array($counts) && $counts['total']) @@ -496,4 +500,4 @@ class admin_account Api\Json\Response::get()->data($e->getMessage()); } } -} +} \ No newline at end of file diff --git a/api/src/Accounts.php b/api/src/Accounts.php index 2ec473a64c..58d08ad136 100644 --- a/api/src/Accounts.php +++ b/api/src/Accounts.php @@ -1159,8 +1159,7 @@ class Accounts { $owner_columns = static::get_owner_columns(); - $selects = array(); - + $selects = $counts = []; foreach($owner_columns as $app => $column) { list($table, $column_name) = explode('.', $column['column']); @@ -1184,15 +1183,11 @@ class Accounts break; } $selects[] = $select; + $counts[$app] = ['total' => 0]; } - $counts = array(); foreach($GLOBALS['egw']->db->union($selects, __LINE__ , __FILE__) as $row) { - if(!is_array($counts[$row['app']])) - { - $counts[$row['app']] = array('total' => 0); - } $counts[$row['app']][$row['type']] = $row['count']; if($row['type'] != 'total') { @@ -1540,4 +1535,4 @@ class Accounts self::$_instance = NULL; } } -} +} \ No newline at end of file