diff --git a/CHANGELOG.md b/CHANGELOG.md index e77b78ef..1c35812b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). + +## ['UNRELEASED'] + +### Fixed + +- Fix UI with GLPI 11 +- Fix `tab` container not displayed + ## [1.22.0] - 2025-09-30 ### Added diff --git a/inc/container.class.php b/inc/container.class.php index dc448ff4..af804251 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -1240,13 +1240,12 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) if (!$item->isEntityAssign() || in_array($item->fields['entities_id'], $entities)) { $display_condition = new PluginFieldsContainerDisplayCondition(); if ($display_condition->computeDisplayContainer($item, $data['id'])) { - $tabs_entries[$tab_name] = self::createTabEntry($data['label'], 0, null, PluginFieldsContainer::getIcon()); + $tabs_entries[$data['id']] = self::createTabEntry($data['label'], 0, null, PluginFieldsContainer::getIcon()); } } } } } - return $tabs_entries; } @@ -1262,11 +1261,10 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ //retrieve container for current tab $container = new self(); - $found_c = $container->find(['type' => 'tab', 'name' => $tabnum, 'is_active' => 1]); - foreach ($found_c as $data) { - $dataitemtypes = json_decode($data['itemtypes']); + if ($container->getFromDB($tabnum)) { + $dataitemtypes = json_decode($container->fields['itemtypes']); if (in_array(get_class($item), $dataitemtypes) != false) { - return PluginFieldsField::showForTabContainer($data['id'], $item); + return PluginFieldsField::showForTabContainer($container->fields['id'], $item); } } diff --git a/inc/field.class.php b/inc/field.class.php index 21b5dfc4..0257413d 100644 --- a/inc/field.class.php +++ b/inc/field.class.php @@ -813,9 +813,6 @@ public function showForm($ID, $options = []) public static function showForTabContainer($c_id, $item) { - /** @var array $CFG_GLPI */ - global $CFG_GLPI; - //profile restriction $right = PluginFieldsProfile::getRightOnContainer($_SESSION['glpiactiveprofile']['id'], $c_id); if ($right < READ) { @@ -826,22 +823,16 @@ public static function showForTabContainer($c_id, $item) //get fields for this container $field_obj = new self(); $fields = $field_obj->find(['plugin_fields_containers_id' => $c_id, 'is_active' => 1], 'ranking'); - echo "