Skip to content

[main] FIX / Tag search criterion matching items of other types - #410

Draft
glpi-project[bot] wants to merge 1 commit into
mainfrom
forward-port/403-to-main
Draft

glpi-project[bot] wants to merge 1 commit into
mainfrom
forward-port/403-to-main

Conversation

@glpi-project

@glpi-project glpi-project Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Forward-port of #403 to main.

  • 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):

@glpi-project

glpi-project Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin forward-port/403-to-main
git worktree add --checkout .worktree/forward-port/403-to-main forward-port/403-to-main
cd .worktree/forward-port/403-to-main
git reset --hard HEAD^
git cherry-pick -x 4f807374885f3cab1923cfc04707a27bd6fc46d1

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.

1 participant