Skip to content

fix(fields): apply a fields default value to existing items on creation - #1273

Open
MyvTsv wants to merge 1 commit into
pluginsGLPI:mainfrom
MyvTsv:ticket46151
Open

MyvTsv wants to merge 1 commit into
pluginsGLPI:mainfrom
MyvTsv:ticket46151

Conversation

@MyvTsv

@MyvTsv MyvTsv commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
  • 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 !46151
  • Here is a brief description of what this PR does

Root cause

When an admin added a new field with a default value to an existing
container, only items saved afterward received that default value.
Items that already existed:

  • kept an empty value in the container table (no retroactive backfill), and
  • showed a blank column in search results whenever they had no dedicated
    row at all in the container table, since the search engine only reads
    the raw stored/joined value, with no fallback to the field's default.

Steps to reproduce (before the fix)

  1. Create a container on Ticket with a field, and fill it in on an
    existing ticket.
  2. Add a new field to the same container with a default value.
  3. The existing ticket's new column stays empty instead of showing the
    default.
  4. In the Ticket search, add the new field's column: it shows blank for
    tickets with no row at all in the container table, instead of the
    configured default.

Screenshots (if appropriate):

@MyvTsv MyvTsv self-assigned this Sep 23, 2026
@MyvTsv
MyvTsv marked this pull request as ready for review September 25, 2026 07:57
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.

3 participants