mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-01 08:00:47 +08:00
Fix subpanels not showing correct number
This commit is contained in:
parent
5ef4351996
commit
8834ba63ec
1 changed files with 14 additions and 5 deletions
|
@ -60,6 +60,7 @@ class SubpanelDefault extends SubpanelDataQueryHandler implements StatisticsProv
|
|||
public function getData(array $query): Statistic
|
||||
{
|
||||
|
||||
$count = 0;
|
||||
$subpanel = $query['params']['subpanel'] ?? $query['key'];
|
||||
|
||||
[$module, $id] = $this->extractContext($query);
|
||||
|
@ -82,13 +83,21 @@ class SubpanelDefault extends SubpanelDataQueryHandler implements StatisticsProv
|
|||
$dbQuery = $queries['isDatasourceFunction']['countQuery'];
|
||||
|
||||
} else {
|
||||
$parts = $queries[0];
|
||||
$parts['select'] = 'SELECT COUNT(*) as value';
|
||||
|
||||
$dbQuery = $this->joinQueryParts($parts);
|
||||
foreach($queries as $query) {
|
||||
$parts = $query;
|
||||
$parts['select'] = 'SELECT COUNT(*) as value';
|
||||
$dbQuery = $this->joinQueryParts($parts);
|
||||
$result = $this->fetchRow($dbQuery);
|
||||
$count = $count + $result['value'];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->fetchRow($dbQuery);
|
||||
if ($count === 0){
|
||||
$count = "0";
|
||||
}
|
||||
|
||||
$result['value'] = $count;
|
||||
|
||||
$statistic = $this->buildSingleValueResponse(self::KEY, 'int', $result);
|
||||
|
||||
$this->addMetadata($statistic, ['descriptionKey' => 'LBL_DEFAULT_TOTAL']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue