Skip to content

Fix Custom Dropdown filtering in table questions - #46

Open
UncleTomsCabi wants to merge 3 commits into
pluginsGLPI:mainfrom
UncleTomsCabi:fix/custom-dropdown-filtering
Open

Fix Custom Dropdown filtering in table questions#46
UncleTomsCabi wants to merge 3 commits into
pluginsGLPI:mainfrom
UncleTomsCabi:fix/custom-dropdown-filtering

Conversation

@UncleTomsCabi

Copy link
Copy Markdown

When using GLPI Custom Dropdowns inside table questions, all dropdown definitions display the same combined list of values.

This happens because all custom dropdowns use the same database table (glpi_dropdowns_dropdowns), but the current implementation does not apply the system criteria that distinguish each dropdown definition.

Solution

This change updates the table question implementation to correctly filter Custom Dropdown values by applying the item's getSystemSQLCriteria() when:

  • loading dropdown options;
  • resolving stored values.

As a result, each Custom Dropdown now displays only the values that belong to its own definition.

Before

Снимок экрана 2026-07-21 143100 Снимок экрана 2026-07-21 143054

After

Screenshot 2026-07-31 163806 Screenshot 2026-07-31 163809

When using GLPI Custom Dropdowns inside table questions, all dropdown definitions display the same combined list of values.

This happens because all custom dropdowns use the same database table (`glpi_dropdowns_dropdowns`), but the current implementation does not apply the system criteria that distinguish each dropdown definition.

## Solution

This change updates the table question implementation to correctly filter Custom Dropdown values by applying the item's `getSystemSQLCriteria()` when:

- loading dropdown options;
- resolving stored values.

As a result, each Custom Dropdown now displays only the values that belong to its own definition.

Before

<img width="290" height="339" alt="Снимок экрана 2026-07-21 143100" src="https://github.com/user-attachments/assets/fc015b93-514c-4d16-84e2-0909d5e6e3a1" />
<img width="211" height="335" alt="Снимок экрана 2026-07-21 143054" src="https://github.com/user-attachments/assets/04f9cd49-92bb-42f2-97ed-4e8b675d4367" />

After

<img width="226" height="238" alt="Screenshot 2026-07-31 163806" src="https://github.com/user-attachments/assets/7da6c20d-1124-44b2-a6b1-5f69ef69c6e1" />
<img width="250" height="266" alt="Screenshot 2026-07-31 163809" src="https://github.com/user-attachments/assets/56dcdc8f-2074-4845-aa97-d704016fdd77" />
@Rom1-B
Rom1-B requested review from Rom1-B and RomainLvr August 7, 2026 07:08

@Rom1-B Rom1-B left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please update CHANGELOG, fix lint and add test cases.

- Add regression tests for Custom Dropdown filtering
- Update CHANGELOG
- Fix PHP-CS-Fixer formatting
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.

2 participants