Skip to content

FIX / Clarify mandatory field error when a GLPI form cannot provide it - #1275

Open
Mary-Clb wants to merge 3 commits into
mainfrom
fix/dom-mandatory-field-blocks-form-creation
Open

Mary-Clb wants to merge 3 commits into
mainfrom
fix/dom-mandatory-field-blocks-form-creation

Conversation

@Mary-Clb

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 !46413
  • A mandatory field in a "dom" container blocks the creation of any ticket that does not submit it, including tickets created from a native GLPI form that has no question mapped to that field. The admin only saw a generic "Some mandatory fields are empty" message, with no hint that the form itself was the cause.

The mandatory check is kept, but when nothing was submitted for the container, a second message now states that the form or source creating the item does not provide these fields, and that they must be mapped or made optional.

Warning the admin when the form is saved would have been better, but the GLPI form framework has no hook for a plugin to validate a destination configuration, so it would require changing GLPI core.

Screenshots :

Capture d’écran du 2026-09-28 12-01-33

@Mary-Clb Mary-Clb self-assigned this Sep 28, 2026
@Mary-Clb
Mary-Clb marked this pull request as ready for review September 28, 2026 13:12
@Rom1-B
Rom1-B self-requested a review September 29, 2026 08:47
Comment thread inc/container.class.php
* @return boolean
*/
public static function validateValues($data, $itemtype, $massiveaction)
public static function validateValues($data, $itemtype, $massiveaction, $not_submitted = false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

$not_submitted is actually $item->isNewItem() at the only call site (line 2055), not a generic "nothing submitted" flag. Worth a name/doc that reflects the real coupling, so a future caller doesn't pass true outside the "new item + dom container + empty" case this relies on?

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.

2 participants