Tags search criterion returns items of other itemtypes that share the same ID
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- Une demi-journée
- Accessibilité débutants
- 62/100
Piste de recherche
The bug is in the search option for tags, built in plugin_tag_getAddSearchOptionsNew(). Compare its joinparams with the regular join, since the generated subquery keeps only condition and drops jointype and specific_itemtype. Reproduce with a tag on a Project and a ProjectTask that share an ID, then check that a 'Tags is' search on projects excludes the project. Done when the search returns only items of the searched itemtype and 'is not' behaves correctly.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
GLPI 11.0.11, Tag 2.14.8.
Searching projects with "Tags is ASYS" returns project 80, which only has the tag DNS. Project task 80 has the tag ASYS.
Since use_subquery is set for GLPI >= 10.0.19, the criterion is built as a subquery by Glpi\Search\Provider\SQLProvider. The subquery only keeps joinparams['condition'] of the glpi_plugin_tag_tagitems join and ignores jointype => itemtype_item / specific_itemtype, so there is no filter on itemtype:
`glpi_projects`.`id` IN (SELECT `items_id` FROM `glpi_plugin_tag_tagitems` WHERE true AND `plugin_tag_tags_id` = '111')
Any item of any type with the same ID and the tag matches. With "is not", the item is wrongly excluded. It happens on every itemtype as soon as a tag is used on more than one type (tickets, changes, computers...). The Tags column in the results is correct, the regular LEFT JOIN has the itemtype condition.
Steps to reproduce:
- Allow a tag on Project and ProjectTask.
- Put the tag on a project task whose ID is also the ID of an untagged project.
- Search projects with "Tags is ": the project is returned.
Adding the itemtype as a join condition in plugin_tag_getAddSearchOptionsNew() fixes it, since the subquery keeps condition:
'jointype' => 'itemtype_item',
'specific_itemtype' => $itemtype,
'condition' => ['NEWTABLE.itemtype' => $itemtype],
We run this patch locally. The core subquery could also handle itemtype_item itself.
- Langage dominant
- PHP
- Étoiles
- 30
- Forks
- 26
- Merge moyen
- 1 j 2 h
- PR mergées (30 j)
- 8
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de pluginsGLPI/tag
-
Difficulté 3/5 1-2 jours Accessibilité débutants 56/100
pluginsGLPI/tag#395 ·
Toutes les issues de pluginsGLPI/tag
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
pluginsGLPI/carbon#396 ·
-
[BUG] Bundle products lose their price in RSS feeds: getPrices() was removedPeut-être pris @pcvelz l’a pris aujourd’hui. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
OpenMage/magento-lts#5869 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 1/5 1-3 heures Accessibilité débutants 85/100
modelcontextprotocol/php-sdk#746 ·
Les mainteneurs répondent en général sous 1 jour
-
Map Info Window ButtonsOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
OpenGIS/waymark-wp#82 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour