Skip to content

fix(core): Fix mandatory fields error when creating an item with an assigned technician - #1332

Open
MyvTsv wants to merge 2 commits into
11.0/bugfixesfrom
ticket47460
Open

MyvTsv wants to merge 2 commits into
11.0/bugfixesfrom
ticket47460

Conversation

@MyvTsv

@MyvTsv MyvTsv commented Nov 5, 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 !46829 & !47460
  • Here is a brief description of what this PR does

When an item with a filled mandatory field is created with an assigned technician, the Some mandatory fields are empty error is displayed although the value is saved, and the ticket stays in the New status instead of Processing (assigned).

Steps to reproduce

  1. Go to Setup > Additional fields and create a block:
    • Type: Insertion in the form
    • Associated item type: Ticket
  2. In this block, add a Text field named Tel and check Mandatory field.
  3. Go to Assistance > Tickets > Create ticket.
  4. Fill the title, the description and the Tel field.
  5. In the Actors section, add a technician in Assigned to.
  6. Click Add.

@MyvTsv MyvTsv self-assigned this Nov 5, 2026
@MyvTsv
MyvTsv marked this pull request as ready for review November 6, 2026 09:05
@MyvTsv
MyvTsv requested review from a team, Lainow, Mary-Clb and stonebuzz and removed request for a team November 6, 2026 09:06
Comment thread inc/container.class.php
if ($obj !== false && $obj->getFromDBByCrit(['items_id' => $item->getID()])) {
$data += $obj->fields;
} else {
$data += self::getPendingValues($item, $c_id);

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.

Tab containers are skipped on creation (line 2667, isNewItem() && type !== 'dom'), so they never get an entry in $pending_values; but during the nested status update the item is no longer new, so a tab container with a mandatory field is now validated, finds no row and no pending value, and still raises Some mandatory fields are empty and blocks the switch to Assigned.
This happens whenever the tab container is checked during that nested update (no c_id in the request, i.e. no dom container for the itemtype, or API / generic path), which is the same symptom the PR fixes for dom containers.
Treating an item that is still in $pending_values as being created for the tab skip would close it, with a test using a mandatory field in a tab container.

if (($item->isNewItem() || self::isBeingAdded($item)) && $loc_c->fields['type'] !== 'dom') {
    return [];
}

Dedicated test should be added

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