Skip to content

FIX / Fix mandatory fields check on updates made during item creation - #1337

Open
Mary-Clb wants to merge 2 commits into
11.0/bugfixesfrom
fix/mandatory-check-during-item-creation
Open

Mary-Clb wants to merge 2 commits into
11.0/bugfixesfrom
fix/mandatory-check-during-item-creation

Conversation

@Mary-Clb

@Mary-Clb Mary-Clb commented Nov 6, 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.
  • [xupdate ] 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 ticket is created with a filled mandatory field from a "dom" container and an assignee, an error "Some mandatory fields are empty" is displayed and the ticket stays in the "New" status instead of "Processing (assigned)". This happens with the standard ticket form and with GLPI forms. During Ticket::add(), GLPI runs an internal update() on a new instance to set the assigned status, before the "item_add" hook stores the plugin values. Since #1269, mandatory fields are checked on updates against the persisted values, which do not exist yet at that point, so the check fails and the internal update is cancelled. The issue was reported after #1294, but it is not related to it.

Items being added are now tracked in a WeakMap from "pre_item_add" until "item_add". For an update made in this window, tab containers are skipped as they are on creation, and "dom" containers are checked against the values submitted on the add instead of the database, so status overrides still apply. Tests covering a filled mandatory field, a mandatory field set by a status override, and a mandatory tab container on a ticket created with an assignee are added.

Screenshots :

Before :
Capture d’écran du 2026-11-06 13-45-39
Capture d’écran du 2026-11-06 13-45-06

After :
Capture d’écran du 2026-11-06 13-48-02
Capture d’écran du 2026-11-06 13-47-47

@Mary-Clb Mary-Clb self-assigned this Nov 6, 2026
@Mary-Clb Mary-Clb added the bug label Nov 6, 2026
@Mary-Clb
Mary-Clb marked this pull request as ready for review November 6, 2026 13:09
@Mary-Clb
Mary-Clb requested review from a team, Lainow, RomainLvr and stonebuzz and removed request for a team November 6, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant