8000
Skip to content

Fix missing Device Type/Model dropdowns (Battery, Firmware, Hard Drive) - #25219

Open
aymericcucherousset wants to merge 2 commits into
glpi-project:11.0/bugfixesfrom
aymericcucherousset:fix/25156/device-dropdowns-registration
Open

Fix missing Device Type/Model dropdowns (Battery, Firmware, Hard Drive)#25219
aymericcucherousset wants to merge 2 commits into
glpi-project:11.0/bugfixesfrom
aymericcucherousset:fix/25156/device-dropdowns-registration

Conversation

@aymericcucherousset
@aymericcucherousset aymericcucherousset commented Aug 21, 2026
Copy link
Copy Markdown
Contributor

Summary

  • Dropdown::getStandardDropdownItemTypes() builds Setup > Dropdowns from a hand-maintained list per optgroup. Five Device*Type/Device*Model classes were missing from it, despite being structurally identical to working siblings (same CommonDeviceType/model base, same form routing), a pure registry omission, not a permissions or class-hierarchy bug.
  • Added to the Type optgroup: DeviceHardDriveType, DeviceBatteryType, DeviceFirmwareType.
  • Added to the Model optgroup: DeviceBatteryModel, DeviceFirmwareModel.

Fixes #25156, #25154, #25155.

Test plan

  • testDeviceTypesAndModelsArePresent (tests/functional/DropdownTest.php) walks every base device class from Dropdown::getDeviceItemTypes(), and for each one whose *Type/*Model class exists, asserts it's registered in Dropdown::getStandardDropdownItemTypes()'s Type/Model group.
  • Manual: Setup > Dropdowns now lists Hard Drive Type / Battery Type / Firmware Type / Battery Model / Firmware Model, each with a working Add button.

Comment thread tests/functional/DropdownTest.php Outdated
#[TestWith(['DeviceFirmwareType'])]
#[TestWith(['DeviceBatteryModel'])]
#[TestWith(['DeviceFirmwareModel'])]
public function testDeviceDropdownsArePresent(string $itemtype): void
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more complete test would fetch the list of device types from Dropdown::getDeviceItemTypes(false), check if a type and model class exist for each (Add Type/Model to the end of the class name and check class_exists), and then check it is present in the correct groups from Dropdown::getStandardDropdownItemTypes(false).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hard Drive Type is missing from Dropdowns and cannot be created from the Type page

2 participants

0