fix delete-account did not show 0 entries for InfoLog, also give a total per InfoLog type

This commit is contained in:
ralf 2022-03-15 10:50:57 +02:00
parent 6d61a6ed48
commit 4ca434f500
2 changed files with 9 additions and 10 deletions

View File

@ -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());
}
}
}
}

View File

@ -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;
}
}
}
}