{# # --------------------------------------------------------------------- # # 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 %} {% set field_options = { 'full_width': true, 'fields_template': itiltemplate, 'disabled': (not canupdate), 'add_field_class': (is_expanded ? 'col-sm-6' : ''), } %} {% set itil_layout = user_pref('itil_layout', true) %} {% set headers_states = itil_layout['items'] %}
{% set main_show = headers_states['item-main'] is not defined or headers_states['item-main'] == "true" ? true : false %}

{{ call_plugin_hook('pre_item_form', {"item": item, 'options': params}) }} {% if is_multi_entities_mode() %} {% if item.isNewItem() %} {{ fields.dropdownField( 'Entity', 'entities_id', item.fields['entities_id'], _n('Entity', 'Entities', 1), field_options|merge({ 'entity': userentities, 'on_change': 'this.form.submit()', }) ) }} {% else %} {% set entity_html %} {{ call('Entity::badgeCompletenameLinkById', [item.fields['entities_id']])|raw }} {% endset %} {{ fields.field( '', entity_html, _n('Entity', 'Entities', 1), field_options|merge({ 'add_field_class': 'd-flex align-items-center', }) ) }} {% endif %} {% if item.isField('is_recursive') %} {{ fields.dropdownYesNo( 'is_recursive', item.fields['is_recursive'], __('Child entities'), field_options ) }} {% endif %} {% endif %} {{ fields.datetimeField( 'date', item.fields['date'], __('Opening date'), field_options ) }} {% if item.getType() != 'Ticket' %} {{ fields.datetimeField( 'time_to_resolve', item.fields['time_to_resolve'], __('Time to resolve'), field_options ) }} {% endif %} {% if item.isSolved(true) %} {{ fields.datetimeField( 'solvedate', item.fields['solvedate'], __('Resolution date'), field_options ) }} {% endif %} {% if item.isClosed() %} {{ fields.datetimeField( 'closedate', item.fields['closedate'], __('Close date'), field_options ) }} {% endif %} {% if item.getType() == 'Ticket' %} {% set type_params = { 'value': item.fields['type'], 'width': '100%', 'display': false }|merge(field_options) %} {% if item.isNewItem() %} {% set type_params = type_params|merge({'on_change': 'this.form.submit()',}) %} {% else %} {% set type_params = type_params|merge({'on_change': 'reloadCategory()',}) %} {% endif %} {{ fields.field( 'type', item.dropdownType('type', type_params), _n('Type', 'Types', 1), field_options ) }} {% endif %} {% set cat_params = field_options|merge({ 'entity': item.fields['entities_id'], 'disabled': (not (canupdate or can_requester)), }) %} {% if item.isNewItem() %} {% set cat_params = cat_params|merge({ 'on_change': 'this.form.submit()', }) %} {% endif %} {% if not item.isNewItem() and itiltemplate.isMandatoryField('itilcategories_id') and item.fields['itilcategories_id'] > 0 %} {% set cat_params = cat_params|merge({ 'display_emptychoice': false }) %} {% endif %} {% if item.getType() == 'Ticket' %} {% if item.fields['type'] == constant('Ticket::INCIDENT_TYPE') %} {% set cat_params = cat_params|merge({'condition': {'is_incident': 1}}) %} {% elseif item.fields['type'] == constant('Ticket::DEMAND_TYPE') %} {% set cat_params = cat_params|merge({'condition': {'is_request': 1}}) %} {% endif %} {% elseif item.getType() == 'Problem' %} {% set cat_params = cat_params|merge({'condition': {'is_problem': 1}}) %} {% elseif item.getType() == 'Change' %} {% set cat_params = cat_params|merge({'condition': {'is_change': 1}}) %} {% endif %} {{ fields.dropdownField( 'ITILCategory', 'itilcategories_id', item.fields['itilcategories_id'], _n('Category', 'Categories', 1), cat_params ) }} {{ include('components/itilobject/fields/status.html.twig') }} {% if item.isField('requesttypes_id') %} {{ fields.dropdownField( 'RequestType', 'requesttypes_id', item.fields['requesttypes_id'], 'RequestType'|itemtype_name, field_options|merge({ 'condition': { 'is_active': 1, 'is_ticketheader': 1 } }) ) }} {% endif %} {{ include('components/itilobject/fields/priority_matrix.html.twig') }} {% if item.isField('locations_id') %} {{ fields.dropdownField( 'Location', 'locations_id', item.fields['locations_id'], 'Location'|itemtype_name, field_options|merge({ 'hide_if_no_elements': true, 'entity': item.fields['entities_id'], 'entity_sons': true }) ) }} {% endif %} {% if item.isNewItem() and item.getType() == 'Ticket' %} {{ fields.dropdownField( 'Contract', '_contracts_id', params['_contracts_id']|default(0), 'Contract'|itemtype_name, field_options|merge({ 'entity': item.fields['entities_id'], 'width': '100%', 'hide_if_no_elements': true }) ) }} {% endif %} {% if item.getType() != 'Ticket' or item.isNewItem() %} {{ fields.dropdownTimestampField( 'actiontime', item.fields['actiontime'], __('Total duration'), field_options ) }} {% endif %} {{ include('components/itilobject/fields/global_validation.html.twig') }} {{ call_plugin_hook('post_item_form', {"item": item, 'options': params}) }}
{% set actors_show = headers_states['actors'] is not defined or headers_states['actors'] == "true" ? true : false %}

{{ include('components/itilobject/actors/main.html.twig') }}
{% if item_ticket is defined and item_ticket is not null %} {% set items_show = headers_states['items'] is not defined or headers_states['items'] == "true" ? true : false %}

{{ item_ticket.itemAddForm(item, params|default({})) }}
{% endif %} {% if item.getType() == 'Ticket' %} {% set la_content %} {{ include('components/itilobject/service_levels.html.twig') }} {% endset %} {% if la_content|trim|length > 0 %} {% set nb_la = (item.fields['slas_id_tto'] > 0 ? 1 : 0) + (item.fields['slas_id_ttr'] > 0 ? 1 : 0) + (item.fields['olas_id_tto'] > 0 ? 1 : 0) + (item.fields['olas_id_ttr'] > 0 ? 1 : 0) %} {% set servicelevels_show = headers_states['service-levels'] is defined and headers_states['service-levels'] == "true" ? true : false %}

{{ la_content }}
{% endif %} {% endif %} {% if item.getType() in ['Problem', 'Change'] %} {% set analysis_fields = { 'impactcontent': __('Impacts'), 'causecontent': __('Causes'), 'symptomcontent': __('Symptoms'), 'controlistcontent': __('Control list'), } %} {% set nb_analysis = 0 %} {% for analysis_field, label in analysis_fields %} {% if item.isField(analysis_field) and item.fields[analysis_field]|trim|length > 0 %} {% set nb_analysis = nb_analysis + 1 %} {% endif %} {% endfor %} {% set analysis_show = headers_states['analysis'] is defined and headers_states['analysis'] == "true" ? true : false %}

{% for analysis_field, label in analysis_fields %} {% if item.isField(analysis_field) %} {{ fields.textareaField( analysis_field, item.fields[analysis_field], label, field_options|merge({ 'enable_richtext': true, 'is_horizontal': false, }) ) }} {% endif %} {% endfor %}
{% endif %} {% if item.getType() == 'Change' %} {% set plans_fields = { 'rolloutplancontent': __('Deployment plan'), 'backoutplancontent': __('Backup plan'), 'checklistcontent': __('Checklist'), } %} {% set nb_plans = 0 %} {% for plans_field, label in plans_fields %} {% if item.isField(plans_field) and item.fields[plans_field]|trim|length > 0 %} {% set nb_plans = nb_plans + 1 %} {% endif %} {% endfor %} {% set plans_show = headers_states['plans'] is defined and headers_states['plans'] == "true" ? true : false %}

{% for plans_field, label in plans_fields %} {% if item.isField(plans_field) %} {{ fields.textareaField( plans_field, item.fields[plans_field], label, field_options|merge({ 'enable_richtext': true, 'is_horizontal': false, }) ) }} {% endif %} {% endfor %}
{% endif %} {% if ticket_ticket %} {% set linked_tickets_show = headers_states['linked_tickets'] is defined and headers_states['linked_tickets'] == "true" ? true : false %}

{{ include('components/itilobject/linked_tickets.html.twig') }}
{% endif %}