Repository navigation
[main] FIX / Mandatory dropdown value hidden by a leftover column with the sam… - #1368
Open
glpi-project[bot] wants to merge 1 commit into
Open
glpi-project[bot] wants to merge 1 commit into
glpi-project[bot] wants to merge 1 commit into
Conversation
…am… (#1362) - [x] I have performed a self-review of my code. - [x] I have added tests (when available) that prove my fix is effective or that my feature works. - [x] 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 !47541 - Follow-up of #1269. When a block table contains a leftover column named after a dropdown field (for example after the field was recreated with another type), approving the solution of a change fails with "Some mandatory fields are empty" although the dropdown value is filled. The lookup order in `validateValues`, which checks the field name before the dropdown key, is older but was harmless while only submitted values were validated. Since #1269, updates without submitted values are checked against the whole stored row, so the leftover column (0) now hides the real value stored in `plugin_fields_<name>dropdowns_id`. The value key is now chosen from the field type, as already done elsewhere in the plugin: the dropdown key for dropdown fields, the field name otherwise. A test reproducing the leftover column on a change update is added. ## Screenshots (if appropriate): (cherry picked from commit db0d7f0)
3 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Forward-port of #1362 to
main.Description
When a block table contains a leftover column named after a dropdown field (for example after the field was recreated with another type), approving the solution of a change fails with "Some mandatory fields are empty" although the dropdown value is filled. The lookup order in
validateValues, which checks the field name before the dropdown key, is older but was harmless while only submitted values were validated. Since #1269, updates without submitted values are checked against the whole stored row, so the leftover column (0) now hides the real value stored inplugin_fields_<name>dropdowns_id.The value key is now chosen from the field type, as already done elsewhere in the plugin: the dropdown key for dropdown fields, the field name otherwise. A test reproducing the leftover column on a change update is added.
Screenshots (if appropriate):