Skip to content

Commit 34f9d00

Browse files
authored
fix(helpdesk): fix reportSunburstTicketByCategories chart (#352)
* fix(helpdesk): fix reportSunburstTicketByCategories chart * Update Changelog.md
1 parent 319cba8 commit 34f9d00

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
- Fix GLIP Stat injection
1313
- Fix missing icon
14+
- Fix missing categories in `reportSunburstTicketByCategories` chart.
1415

1516
## [1.9.3] - 2026-01-08
1617

inc/helpdesk.class.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -850,15 +850,17 @@ public function reportSunburstTicketByCategories($config = [])
850850
//get full parent list
851851
krsort($flat_datas);
852852
$itilcategory = new ITILCategory();
853-
foreach ($flat_datas as $cat_id => $current_datas) {
854-
if (!isset($flat_datas[$current_datas['parent']]) && ($current_datas['parent'] != 0 && $itilcategory->getFromDB(intval($current_datas['parent'])))) {
855-
856-
$flat_datas[$current_datas['parent']] = [
857-
'id' => $current_datas['parent'],
858-
'name' => htmlspecialchars($itilcategory->fields['name']),
859-
'parent' => $itilcategory->fields['itilcategories_id'],
860-
'count' => 0,
861-
];
853+
foreach ($flat_datas as $current_datas) {
854+
$ancestors = getAncestorsOf(ITILCategory::getTable(), $current_datas['id']);
855+
foreach ($ancestors as $ancestor) {
856+
if (!isset($flat_datas[$ancestor]) && $ancestor != 0 && $itilcategory->getFromDB(intval($ancestor))) {
857+
$flat_datas[$ancestor] = [
858+
'id' => $ancestor,
859+
'name' => htmlspecialchars($itilcategory->fields['name']),
860+
'parent' => $itilcategory->fields['itilcategories_id'],
861+
'count' => 0,
862+
];
863+
}
862864
}
863865
}
864866

0 commit comments

Comments
 (0)