Skip to content

Commit e4c6ffe

Browse files
committed
fix(abstracttarget): support for sla and ola from question
1 parent c04c71b commit e4c6ffe

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

inc/field/dropdownfield.class.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
use Ticket_User;
5555
use Search;
5656
use SLA;
57+
use SLM;
5758
use OLA;
5859
use QuerySubQuery;
5960
use QueryUnion;
@@ -89,6 +90,7 @@ public function showForm(array $options): void {
8990
$this->question->fields['_tree_root_selectable'] = $decodedValues['selectable_tree_root'] ?? '0';
9091
$this->question->fields['_tree_max_depth'] = $decodedValues['show_tree_depth'] ?? Dropdown::EMPTY_VALUE;
9192
$this->question->fields['_show_ticket_categories'] = isset($decodedValues['show_ticket_categories']) ? $decodedValues['show_ticket_categories'] : 'both';
93+
$this->question->fields['_show_service_level_types'] = isset($decodedValues['show_service_level_types']) ? $decodedValues['show_service_level_types'] : SLM::TTO;
9294
$this->question->fields['_entity_restrict'] = $decodedValues['entity_restrict'] ?? self::ENTITY_RESTRICT_FORM;
9395
$this->question->fields['_is_tree'] = '0';
9496
$this->question->fields['_is_entity_restrict'] = '0';
@@ -514,8 +516,8 @@ public function prepareQuestionInputForSave($input) {
514516
} else if ($input['itemtype'] == SLA::getType()
515517
|| $input['itemtype'] == OLA::getType()
516518
) {
517-
$input['values']['show_service_level_types'] = $input['show_service_level_types'];
518-
unset($input['show_service_level_types']);
519+
$input['values']['show_service_level_types'] = $input['_show_service_level_types'];
520+
unset($input['_show_service_level_types']);
519521
}
520522

521523
// Params for entity restrictables itemtypes

templates/field/dropdownfield.html.twig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,25 @@
9999
}) }}
100100
{% endif %}
101101

102+
{% if item.fields['itemtype'] is defined and (item.fields['itemtype'] == 'SLA' or item.fields['itemtype'] == 'OLA' ) %}
103+
{# keys are SLM:TTR, SLM::TTO #}
104+
{{ fields.dropdownArrayField(
105+
'_show_service_level_types',
106+
item.fields['_show_service_level_types'],
107+
{
108+
0: __('Time to resolve', 'formcreator'),
109+
1: __('Time to own', 'formcreator'),
110+
},
111+
__('Type', 'formcreator')
112+
) }}
113+
114+
{{ fields.nullField({
115+
label_class: 'col-xxl-4',
116+
input_class: 'col-xxl-8',
117+
}) }}
118+
{% endif %}
119+
120+
102121
{# _is_tree is set in the showForm method, and helps to find if the itemtype is a tree #}
103122
{% if item.fields['_is_tree'] == '1' %}
104123

0 commit comments

Comments
 (0)