Skip to content

FIX / Tag search criterion matching items of other types - #403

Open
Mary-Clb wants to merge 2 commits into
11.0/bugfixesfrom
fix/search-tag-itemtype
Open

Mary-Clb wants to merge 2 commits into
11.0/bugfixesfrom
fix/search-tag-itemtype

Conversation

@Mary-Clb

Copy link
Copy Markdown
  • 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 !47622

When searching on the Tags criterion from an itemtype list (e.g. Assets > Computers with "Tags is X"), the results include items that do not have the tag. These items share their ID with an item of another type (e.g. a phone) that does have the tag, and their Tags column is empty. The "is not" and "contains" search types are affected the same way, wrongly excluding or including items.

Since use_subquery is enabled on this search option, the core builds a items_id IN (SELECT ...) subquery on glpi_plugin_tag_tagitems that only takes the link table condition into account and ignores specific_itemtype, so the subquery is not filtered on itemtype. The fix adds an explicit itemtype condition on the link table join, which the core applies to both the join and the subquery. A test covering the equals, notequals and contains search types has been added.

Screenshots (if appropriate):

@Mary-Clb Mary-Clb self-assigned this Nov 13, 2026
@Mary-Clb Mary-Clb changed the title fix tag search criterion matching items of other types FIX / Tag search criterion matching items of other types Nov 13, 2026
@Mary-Clb Mary-Clb added the bug label Nov 13, 2026
@Mary-Clb
Mary-Clb marked this pull request as ready for review November 13, 2026 15:31
@Mary-Clb
Mary-Clb requested review from a team, Lainow, MyvTsv and jdurand-teclib and removed request for a team November 13, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants