Skip to content

Predefined and hidden field values are not saved on ticket when using a template #21128

@Gabilach

Description

@Gabilach

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

Start from 10.0.19

Bug description

Hello,

For years, I have been using a simplified ticket template with the Group requester field predefined and hidden. This allows certain fields to have predefined values that end users cannot see or modify (in my case, to set a specific group as requester).

Since GLPI 10.0.19, if a field is hidden and has a predefined value, it is not saved when creating a ticket.

Expected behavior:
The hidden field value should be saved on ticket creation, as it was in versions prior to 10.0.19.

Technical details:
Before 10.0.19, in src/Ticket.php, showFormHelpdesk() directly inserted default values into $default_values, which did not include _groups_id_requester. Predefined hidden fields were therefore added to $options['_hidden_fields'] and saved correctly.

Since 10.0.19, $default_values is retrieved via self::getDefaultValues(), and _groups_id_requester now has a default value (0). This prevents setPredefinedFields() from adding it to hidden_fields, so the value is not saved on ticket creation.

Steps To reproduce

  1. Create a simplified ticket template.
  2. Set a predefined value for the Group requester field.
  3. Set the Group observer field as hidden.
  4. Create a ticket using the ticket template.
  5. Check the ticket and notice that the group is missing.

Your GLPI setup information

GLPI 10.0.19

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions