Skip to content

Conversation

@btry
Copy link
Contributor

@btry btry commented Nov 14, 2022

requires SQL DISTINCT keyword to deduplicate entries; see commit 4040079

In Formcreator's incoming feature to filter dropdowns (GLPI object or dropdown question types) items may e duplicated when a search filter is implemented.

To reproduce :

Use Formcreator branch support/2.14.0 with PR pluginsGLPI/formcreator#2978 (and dependencies in GLPI; see its description)

  • Create 2 or more computers
  • Create an appliance
  • Add several computers as items in the appliance
  • Create a form with a question of type GLPI Object / Appliance
  • Add a search filter on this question which allows the appliance to show
  • Preview the form; develop the dropdown of the question
  • See that the appliance appears as many times as items linked to it.

The problem comes from the lack of DISTINCT in the query which feeds the dropdown, via Dropdown::getDropdownValue() because such filter adds LEFT JOIN clauses.

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #number

@btry btry self-assigned this Nov 14, 2022
requires SQL DISTINCT keyword to deduplicate entries; see commit 4040079
@btry btry force-pushed the getdropdowvalue_requires_distinct branch from 8777eda to f4ba45b Compare November 14, 2022 13:24
Copy link
Contributor

@trasher trasher left a comment

Choose a reason for hiding this comment

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

Sounds good to me, but I cannot say if that can cause any issue

@trasher trasher merged commit da7fd55 into glpi-project:main Nov 15, 2022
@btry btry deleted the getdropdowvalue_requires_distinct branch January 4, 2023 10:33
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.

4 participants