From 27f242f80eacd0a657284814f2f1f4eb2bd96446 Mon Sep 17 00:00:00 2001 From: Walid Date: Wed, 23 Sep 2015 10:56:36 +0200 Subject: [PATCH] close #49 Family name translations not taken into account in the menu Assets --- front/familylist.php | 2 +- inc/object.class.php | 13 +++++++------ inc/typefamily.class.php | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/front/familylist.php b/front/familylist.php index 6300c44a..e53e0842 100644 --- a/front/familylist.php +++ b/front/familylist.php @@ -43,7 +43,7 @@ echo ""; $types = PluginGenericobjectTypeFamily::getItemtypesByFamily($_GET['id']); - echo ""; + echo ""; foreach ($types as $type) { $itemtype = $type['itemtype']; echo "
".$family->getField("name")."
".Dropdown::getDropdownName("glpi_plugin_genericobject_typefamilies", $_GET['id'])."
"; diff --git a/inc/object.class.php b/inc/object.class.php index 0b29aa76..749b5bec 100644 --- a/inc/object.class.php +++ b/inc/object.class.php @@ -1099,11 +1099,12 @@ static function getMenuContent() { if ($type['plugin_genericobject_typefamilies_id'] > 0 && (!isset($_GET['itemtype']) || !preg_match("/itemtype=".$_GET['itemtype']."/", $_GET['itemtype']))) { - $family = new PluginGenericobjectTypeFamily(); - $family->getFromDB($type['plugin_genericobject_typefamilies_id']); - $menu[strtolower($family->getName())]['title'] = $family->getName(); - $menu[strtolower($family->getName())]['page'] = '/plugins/genericobject/front/familylist.php?id='.$family->getID(); - $menu[strtolower($family->getName())]['options'][strtolower($itemtype)] = + $family_id = $type['plugin_genericobject_typefamilies_id']; + $name = Dropdown::getDropdownName("glpi_plugin_genericobject_typefamilies", $family_id, 0, false); + $str_name = strtolower($name); + $menu[$str_name]['title'] = Dropdown::getDropdownName("glpi_plugin_genericobject_typefamilies", $family_id); + $menu[$str_name]['page'] = '/plugins/genericobject/front/familylist.php?id='.$family_id; + $menu[$str_name]['options'][strtolower($itemtype)] = array('title' => $type['itemtype']::getMenuName(), 'page' => $itemtype::getSearchUrl(false), 'links' => $links); @@ -1123,4 +1124,4 @@ static function getMenuContent() { return $menu; } -} \ No newline at end of file +} diff --git a/inc/typefamily.class.php b/inc/typefamily.class.php index 2a10ddd4..b5b3a03c 100644 --- a/inc/typefamily.class.php +++ b/inc/typefamily.class.php @@ -30,6 +30,7 @@ } class PluginGenericobjectTypeFamily extends CommonDropdown { + var $can_be_translated = true; static function getTypeName($nb=0) { return __('Family of type of objects', 'genericobject');