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

Commit

Permalink
fix(ui): compatibility with GLPI 9.1.x when counting agents in a fleet
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Mar 26, 2017
1 parent 162ec6a commit 5df5739
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions inc/agent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
if (!$withtemplate) {
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countElementsInTable(static::getTable(),
['itemtype' => $item->getType(),
'items_id' => $item->getID()]);
if (version_compare(GLPI_VERSION, '9.2') < 0) {
$fleetId = $item->getID();
$nb = countElementsInTable(static::getTable(), "`plugin_flyvemdm_fleets_id` = '$fleetId'");
} else {
$nb = countElementsInTable(static::getTable(),
['plugin_flyvemdm_fleets_id' => $item->getID()]);
}
}
return self::createTabEntry(self::getTypeName(1), $nb);
}
Expand Down

0 comments on commit 5df5739

Please sign in to comment.