From 1f780370a95ddadf561b11e2dee49af291ce7bfc Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Thu, 1 Dec 2022 08:57:40 +0100 Subject: [PATCH] fix(question): subtype plural and appliance in bad group --- inc/question.class.php | 60 ++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/inc/question.class.php b/inc/question.class.php index d074cc854..3ebf9e65e 100644 --- a/inc/question.class.php +++ b/inc/question.class.php @@ -1193,52 +1193,54 @@ public static function dropdownDropdownSubType(string $name, array $options = [] } public static function dropdownObjectSubType(string $name, array $options = []): void { + $plural = Session::getPluralNumber(); + $optgroup = [ __("Assets") => [ - Computer::class => Computer::getTypeName(2), - Monitor::class => Monitor::getTypeName(2), - Software::class => Software::getTypeName(2), - NetworkEquipment::class => Networkequipment::getTypeName(2), - Peripheral::class => Peripheral::getTypeName(2), - Printer::class => Printer::getTypeName(2), - CartridgeItem::class => CartridgeItem::getTypeName(2), - ConsumableItem::class => ConsumableItem::getTypeName(2), - Phone::class => Phone::getTypeName(2), - Line::class => Line::getTypeName(2), - PassiveDCEquipment::class => PassiveDCEquipment::getTypeName(2), - Appliance::class => Appliance::getTypeName(2), + Computer::class => Computer::getTypeName($plural), + Monitor::class => Monitor::getTypeName($plural), + Software::class => Software::getTypeName($plural), + NetworkEquipment::class => Networkequipment::getTypeName($plural), + Peripheral::class => Peripheral::getTypeName($plural), + Printer::class => Printer::getTypeName($plural), + CartridgeItem::class => CartridgeItem::getTypeName($plural), + ConsumableItem::class => ConsumableItem::getTypeName($plural), + Phone::class => Phone::getTypeName($plural), + Line::class => Line::getTypeName($plural), + PassiveDCEquipment::class => PassiveDCEquipment::getTypeName($plural), ], __("Assistance") => [ - Ticket::class => Ticket::getTypeName(2), - Problem::class => Problem::getTypeName(2), - Change::class => Change::getTypeName(2), - TicketRecurrent::class => TicketRecurrent::getTypeName(2) + Ticket::class => Ticket::getTypeName($plural), + Problem::class => Problem::getTypeName($plural), + Change::class => Change::getTypeName($plural), + TicketRecurrent::class => TicketRecurrent::getTypeName($plural), ], __("Management") => [ - Budget::class => Budget::getTypeName(2), - Supplier::class => Supplier::getTypeName(2), - Contact::class => Contact::getTypeName(2), - Contract::class => Contract::getTypeName(2), - Document::class => Document::getTypeName(2), - Project::class => Project::getTypeName(2), - Certificate::class => Certificate::getTypeName(2) + Budget::class => Budget::getTypeName($plural), + Supplier::class => Supplier::getTypeName($plural), + Contact::class => Contact::getTypeName($plural), + Contract::class => Contract::getTypeName($plural), + Document::class => Document::getTypeName($plural), + Project::class => Project::getTypeName($plural), + Certificate::class => Certificate::getTypeName($plural), + Appliance::class => Appliance::getTypeName($plural), ], __("Tools") => [ Reminder::class => __("Notes"), RSSFeed::class => __("RSS feed") ], __("Administration") => [ - User::class => User::getTypeName(2), - Group::class => Group::getTypeName(2), - Entity::class => Entity::getTypeName(2), - Profile::class => Profile::getTypeName(2) + User::class => User::getTypeName($plural), + Group::class => Group::getTypeName($plural), + Entity::class => Entity::getTypeName($plural), + Profile::class => Profile::getTypeName($plural), ], ]; if ((new Plugin())->isActivated('appliances')) { - $optgroup[__("Assets")][PluginAppliancesAppliance::class] = PluginAppliancesAppliance::getTypeName(2) . ' (' . _n('Plugin', 'Plugins', 1) . ')'; + $optgroup[__("Assets")][PluginAppliancesAppliance::class] = PluginAppliancesAppliance::getTypeName($plural) . ' (' . _n('Plugin', 'Plugins', 1) . ')'; } if ((new Plugin())->isActivated('databases')) { - $optgroup[__("Assets")][PluginDatabasesDatabase::class] = PluginDatabasesDatabase::getTypeName(2) . ' (' . _n('Plugin', 'Plugins', 1) . ')'; + $optgroup[__("Assets")][PluginDatabasesDatabase::class] = PluginDatabasesDatabase::getTypeName($plural) . ' (' . _n('Plugin', 'Plugins', 1) . ')'; } // Get additional itemtypes from plugins