Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
fix: graphs
Browse files Browse the repository at this point in the history
Change in schema broke operating systems graph
Move from plugins to admin required change to load charts js lib
  • Loading branch information
btry committed Jul 26, 2017
1 parent 1c27560 commit 46f603f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions inc/graph.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function showDevicesPerOSVersion() {
$config = Config::getConfigurationValues('flyvemdm', ['computertypes_id']);
$computerTypeId = $config['computertypes_id'];
$computerTable = Computer::getTable();
$itemOperatingSystemTable = Item_OperatingSystem::getTable();
$operatingSystemTable = OperatingSystem::getTable();
$operatingSystemVersionTable = OperatingSystemVersion::getTable();
$entityRestrict = getEntitiesRestrictRequest(" AND ", $computerTable);
Expand All @@ -88,10 +89,12 @@ public function showDevicesPerOSVersion() {
`osv`.`name` AS `version`,
COUNT(*) AS `cpt`
FROM `$computerTable`
LEFT JOIN `$itemOperatingSystemTable` AS `i_os`
ON (`i_os`.itemtype = 'Computer' AND `i_os`.`items_id` = `$computerTable`.`id`)
LEFT JOIN `$operatingSystemTable` AS `os`
ON (`os`.`id` = `$computerTable`.`operatingsystems_id`)
ON (`os`.`id` = `i_os`.`operatingsystems_id`)
LEFT JOIN `$operatingSystemVersionTable` AS `osv`
ON (`osv`.`id` = `$computerTable`.`operatingsystemversions_id`)
ON (`osv`.`id` = `i_os`.`operatingsystemversions_id`)
WHERE `$computerTable`.`computertypes_id` = '$computerTypeId' $entityRestrict
GROUP BY `operatingsystem`, `version`";
$result = $DB->query($query);
Expand Down Expand Up @@ -154,7 +157,6 @@ public function showDevicesPerOSVersion() {
* @return void
*/
public function displayStackedBarGraph($title, $labels, $series, $options = null, $display = true) {

$param = [
'width' => 900,
'height' => 300,
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function plugin_init_flyvemdm() {
}

Html::requireJs('charts');
$CFG_GLPI['javascript']['plugins']['pluginflyvemdmmenu']['Menu'] = ['charts'];
$CFG_GLPI['javascript']['admin']['pluginflyvemdmmenu']['Menu'] = ['charts'];
}
}

Expand Down

0 comments on commit 46f603f

Please sign in to comment.