{# # --------------------------------------------------------------------- # # 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 . # # --------------------------------------------------------------------- #} {% set is_timeline_reversed = user_pref('timeline_order') == constant('CommonITILObject::TIMELINE_ORDER_REVERSE') %}
{% if not is_timeline_reversed %} {{ include('components/itilobject/timeline/main_description.html.twig') }} {% else %} {{ include('components/itilobject/timeline/approbation_form.html.twig') }} {{ include('components/itilobject/answer.html.twig') }} {% endif %} {% set status_closed = (item.fields['status'] in item.getClosedStatusArray()) %} {% for entry in timeline %} {% set entry_i = entry['item'] %} {% set entry_object = get_item(entry['type'], entry_i['id']) %} {% set users_id = entry_i['users_id'] %} {% set is_private = entry_i['is_private'] ?? false %} {% set date_creation = entry_i['date_creation'] ?? entry_i['date'] %} {% set date_mod = entry_i['date_mod'] %} {% set entry_rand = random() %} {% set is_current_user = users_id == session('glpiID') %} {% set anonym_user = (get_current_interface() == 'helpdesk' and not is_current_user and entity_config('anonymize_support_agents', session('glpiactive_entity')) != constant('Entity::ANONYMIZE_DISABLED')) %} {% set can_edit_i = entry_i['can_edit'] %} {% set can_promote = (entry['type'] == 'ITILFollowup' or entry['type'] == 'TicketTask') and can_edit_i and not status_closed %} {% set is_promoted = can_promote and entry_i['sourceof_items_id'] > 0 %} {% set timeline_position = entry_i['timeline_position'] %} {% set item_position = 't-left' %} {% if timeline_position == constant('CommonITILObject::TIMELINE_LEFT') %} {% set item_position = 't-left' %} {% elseif timeline_position == constant('CommonITILObject::TIMELINE_MIDLEFT') %} {% set item_position = 't-left t-middle' %} {% elseif timeline_position == constant('CommonITILObject::TIMELINE_MIDRIGHT') %} {% set item_position = 't-right t-middle' %} {% elseif timeline_position == constant('CommonITILObject::TIMELINE_RIGHT') %} {% set item_position = 't-right' %} {% endif %} {% set itiltype = entry['itiltype'] is defined ? 'ITIL' ~ entry['itiltype'] : entry['type'] %} {% set state_class = '' %} {% if entry_i['state'] is constant('Planning::INFO') %} {% set state_class = 'info' %} {% endif %} {% if entry_i['state'] is constant('Planning::TODO') %} {% set state_class = 'todo' %} {% endif %} {% if entry_i['state'] is constant('Planning::DONE') %} {% set state_class = 'done' %} {% endif %} {% set solution_class = '' %} {% if (itiltype == 'ITILSolution' or itiltype == 'ITILValidation') and entry_i['status'] is defined %} {% set status = itiltype == 'ITILSolution' ? entry_i['status'] : entry_i['status']|replace({'status_': ''}) %} {% if status == constant('CommonITILValidation::WAITING') %} {% set solution_class = 'waiting' %} {% endif %} {% if status == constant('CommonITILValidation::ACCEPTED') %} {% set solution_class = 'accepted' %} {% endif %} {% if status == constant('CommonITILValidation::REFUSED') %} {% set solution_class = 'refused' %} {% endif %} {% endif %}
{{ call_plugin_hook(constant('Glpi\\Plugin\\Hooks::PRE_SHOW_ITEM'), {'item': entry_object, 'options': {'parent': item, 'rand': entry_rand}}) }}
{% if entry_i['state'] is constant('Planning::TODO') %} {% if can_edit_i %} {% else %} {% endif %} {% elseif entry_i['state'] is constant('Planning::DONE') %} {% if can_edit_i %} {% else %} {% endif %} {% endif %}
{% set avatar_rand = random() %} {# log entries have no users_id #} {% set entry_user = users_id is defined and users_id is not null ? get_item('User', users_id) : null %} {% if entry_user is not null %} {% set user_fields = entry_user.fields %} {% set user_fields = user_fields|merge({user_name: entry_user.getFriendlyName()|verbatim_value}) %} {% set user_fields = user_fields|merge({email: entry_user.getDefaultEmail()}) %} {{ include('components/user/picture.html.twig', { 'users_id': users_id, 'enable_anonymization': anonym_user }, with_context = false) }} {% if not anonym_user %} {% do call('Html::showToolTip', [ include('components/user/info_card.html.twig', { 'user': user_fields, 'enable_anonymization': false, }, with_context = false), { 'applyto': 'timeline-avatar' ~ avatar_rand }]) %} {% endif %} {% else %} {% endif %}
{{ include('components/itilobject/timeline/timeline_item_header.html.twig') }} {% if itiltype in timeline_itemtypes|column('type') %} {% set matching_types = timeline_itemtypes|filter((v) => v.type == itiltype) %} {% if matching_types|length > 0 %} {% set timeline_itemtype = matching_types|first %} {% if timeline_itemtype.template is defined %} {{ include(timeline_itemtype.template, {'form_mode': 'view'}) }} {% endif %} {% endif %} {% else %}
{{ entry_i['content']|safe_html }}
{% endif %}
{% if entry['documents'] is defined %} {{ include('components/itilobject/timeline/sub_documents.html.twig', { 'item': item, 'entry': entry }) }} {% endif %}
{{ call_plugin_hook(constant('Glpi\\Plugin\\Hooks::POST_SHOW_ITEM'), {'item': entry_object, 'options': {'parent': item, 'rand': entry_rand}}) }}
{% endfor %} {% if is_timeline_reversed %} {{ include('components/itilobject/timeline/main_description.html.twig') }} {% endif %}

{{ _n('Task', 'Tasks', get_plural_number()) }}

{{ include('components/itilobject/timeline/todo-list-summary.html.twig') }}

{{ _n('Validation', 'Validations', get_plural_number()) }}

{% if not is_timeline_reversed %} {{ include('components/itilobject/timeline/approbation_form.html.twig') }} {{ include('components/itilobject/answer.html.twig') }} {% endif %}