{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2023 Teclib' and contributors. # @copyright 2003-2014 by the INDEPNET Development Team. # @licence https://www.gnu.org/licenses/gpl-3.0.html # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # --------------------------------------------------------------------- #} {% import 'components/form/fields_macros.html.twig' as fields %} {% if display_actortypes is not defined %} {% set display_actortypes = ['requester', 'observer', 'assign'] %} {% endif %} {% if display_labels is not defined %} {% set display_labels = true %} {% endif %} {% set actor_options = field_options|merge({ is_horizontal: false, add_field_class: (is_expanded ? 'col-sm-4' : ''), }) %} {% set can_admin = item.canAdminActors() %} {% if item.isNewItem() %} {% set can_admin = true %} {% endif %} {# TODO can_admin is usefull for "assign to me" shortcut #} {# TODO check allow_email params #} {% if 'requester' in display_actortypes and (not itiltemplate.isHiddenField('_users_id_requester') or not itiltemplate.isHiddenField('_groups_id_requester')) %} {% set requester_field %} {{ include('components/itilobject/actors/field.html.twig', { 'item': item, 'actortypeint': constant('CommonITILActor::REQUESTER'), 'actortype': 'requester', 'entities_id': entities_id, 'itiltemplate': itiltemplate, 'params': params, 'canupdate': canupdate, 'canassigntome': canassigntome ?? false, 'main_rand': main_rand, }, with_context = false) }} {% endset %} {% if display_labels %} {{ fields.field( 'requester', requester_field, _n('Requester', 'Requesters', 1), actor_options|merge({ required: itiltemplate.isMandatoryField('_users_id_requester') or itiltemplate.isMandatoryField('_groups_id_requester') }) ) }} {% else %} {{ requester_field }} {% endif %} {% endif %} {% if 'observer' in display_actortypes and (not itiltemplate.isHiddenField('_users_id_observer') or not itiltemplate.isHiddenField('_groups_id_observer')) %} {% set observer_field %} {{ include('components/itilobject/actors/field.html.twig', { 'item': item, 'actortypeint': constant('CommonITILActor::OBSERVER'), 'actortype': 'observer', 'entities_id': entities_id, 'itiltemplate': itiltemplate, 'params': params, 'canupdate': canupdate, 'canassigntome': canassigntome ?? false, 'main_rand': main_rand, }, with_context = false) }} {% endset %} {% if display_labels %} {{ fields.field( 'observer', observer_field, __('Observer'), actor_options|merge({ required: itiltemplate.isMandatoryField('_users_id_observer') or itiltemplate.isMandatoryField('_groups_id_observer') }) ) }} {% else %} {{ observer_field }} {% endif %} {% endif %} {% if 'assign' in display_actortypes and (not itiltemplate.isHiddenField('_users_id_assign') or not itiltemplate.isHiddenField('_groups_id_assign') or not itiltemplate.isHiddenField('_supplier_id_assign')) %} {% set assign_field %} {{ include('components/itilobject/actors/field.html.twig', { 'item': item, 'actortypeint': constant('CommonITILActor::ASSIGN'), 'actortype': 'assign', 'users_right': 'own_ticket', 'entities_id': entities_id, 'itiltemplate': itiltemplate, 'params': params, 'canupdate': canassign, 'canassigntome': canassigntome ?? false, 'main_rand': main_rand, }, with_context = false) }} {% endset %} {% if display_labels %} {{ fields.field( 'assign', assign_field, __('Assigned to'), actor_options|merge({ required: itiltemplate.isMandatoryField('_users_id_assign') or itiltemplate.isMandatoryField('_groups_id_assign') or itiltemplate.isMandatoryField('_supplier_id_assign') }) ) }} {% else %} {{ assign_field }} {% endif %} {% endif %} {# modal for edit notification setting for a user #} {% set actortypes = { 'requester': constant('CommonITILActor::REQUESTER'), 'observer': constant('CommonITILActor::OBSERVER'), 'assign': constant('CommonITILActor::ASSIGN') } %}