Skip to content

[main] FIX / Mandatory dropdown value hidden by a leftover column with the sam… - #1368

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

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

Conversation

@glpi-project

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

Copy link
Copy Markdown
Contributor

Forward-port of #1362 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

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

…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)
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