Skip to content

Comments

Fix - Add explicit itemtype to search option for GLPI custom dropdown fields#1149

Merged
Rom1-B merged 2 commits intomainfrom
fix/massive-action-glpi-dropdown-wrong-itemtype
Feb 23, 2026
Merged

Fix - Add explicit itemtype to search option for GLPI custom dropdown fields#1149
Rom1-B merged 2 commits intomainfrom
fix/massive-action-glpi-dropdown-wrong-itemtype

Conversation

@RomainLvr
Copy link
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

  • It fixes !42293
  • Here is a brief description of what this PR does

When a Fields block contains two GLPI custom dropdown fields (type dropdown-Glpi\CustomDropdown\...), selecting one of them in a bulk "Update" action displayed the values of the wrong dropdown.

In GLPI 11, all custom dropdowns share the same physical table (glpi_dropdowns_dropdowns). CommonDBTM::getValueToSelect() resolves the itemtype via $searchoptions['itemtype'] ?? getItemTypeForTable($searchoptions['table']). Since the table key was identical for all custom dropdown fields, getItemTypeForTable() returned the cached (wrong) itemtype, causing the values of one dropdown to appear in place of the other.

The fix explicitly sets $opt[$i]['itemtype'] in getAddSearchOptions() for non-multiple dropdown-XXXX fields, ensuring CommonDBTM::getValueToSelect() uses the correct itemtype directly without falling back to the ambiguous table-based lookup.

Screenshots (if appropriate):

CustomDropdowns structure :

CustomDropdown >

  • CD1
  • CD2
  • CD3

Other Test >

  • OT1
  • OT2
  • OT3

Before :

image

After :

image

@RomainLvr RomainLvr self-assigned this Feb 23, 2026
@Rom1-B Rom1-B merged commit fe1869f into main Feb 23, 2026
3 checks passed
@Rom1-B Rom1-B deleted the fix/massive-action-glpi-dropdown-wrong-itemtype branch February 23, 2026 12:49
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.

3 participants