From df862263025a7e8bedd40ffb85292ca69c5f0c2a Mon Sep 17 00:00:00 2001 From: Lainow Date: Thu, 17 Oct 2024 11:39:02 +0200 Subject: [PATCH 1/3] Fix tab Label --- inc/container.class.php | 4 ++-- inc/field.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/container.class.php b/inc/container.class.php index bba4e3d6..191843ee 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -1139,7 +1139,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) if (isset($itemtypes[$item->getType()])) { $tabs_entries = []; $container = new self(); - foreach ($itemtypes[$item->getType()] as $tab_name => $tab_label) { + foreach ($itemtypes[$item->getType()] as $tab_name) { // needs to check if entity of item is in hierachy of $tab_name foreach ($container->find(['is_active' => 1, 'name' => $tab_name]) as $data) { $dataitemtypes = json_decode($data['itemtypes']); @@ -1152,7 +1152,7 @@ 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] = $tab_label; + $tabs_entries[$tab_name] = $data['label']; } } } diff --git a/inc/field.class.php b/inc/field.class.php index 8e32845d..45623071 100644 --- a/inc/field.class.php +++ b/inc/field.class.php @@ -512,7 +512,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) if (!$withtemplate) { switch ($item->getType()) { case __CLASS__: - $ong[1] = $this->getTypeName(1); + $ong[1] = "Test"; return $ong; } From 5718afc2fc6e1e38c5a6a74b926611c408b66012 Mon Sep 17 00:00:00 2001 From: LAUNAY Samuel <107540223+Lainow@users.noreply.github.com> Date: Thu, 17 Oct 2024 12:12:20 +0200 Subject: [PATCH 2/3] Update field.class.php --- inc/field.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/field.class.php b/inc/field.class.php index 45623071..8e32845d 100644 --- a/inc/field.class.php +++ b/inc/field.class.php @@ -512,7 +512,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) if (!$withtemplate) { switch ($item->getType()) { case __CLASS__: - $ong[1] = "Test"; + $ong[1] = $this->getTypeName(1); return $ong; } From a49446c6963cd3f7b65f2350e6c7585650eb83c4 Mon Sep 17 00:00:00 2001 From: Lainow Date: Fri, 18 Oct 2024 09:45:06 +0200 Subject: [PATCH 3/3] Add suggestion --- inc/container.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/container.class.php b/inc/container.class.php index 191843ee..01957572 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -1139,7 +1139,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) if (isset($itemtypes[$item->getType()])) { $tabs_entries = []; $container = new self(); - foreach ($itemtypes[$item->getType()] as $tab_name) { + foreach ($itemtypes[$item->getType()] as $tab_name => $tab_label) { // needs to check if entity of item is in hierachy of $tab_name foreach ($container->find(['is_active' => 1, 'name' => $tab_name]) as $data) { $dataitemtypes = json_decode($data['itemtypes']);