Skip to content

Commit

Permalink
fix(abstracttarget): support for sla and ola from question
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Nov 17, 2022
1 parent c04c71b commit e4c6ffe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
6 changes: 4 additions & 2 deletions inc/field/dropdownfield.class.php
Expand Up @@ -54,6 +54,7 @@
use Ticket_User;
use Search;
use SLA;
use SLM;
use OLA;
use QuerySubQuery;
use QueryUnion;
Expand Down Expand Up @@ -89,6 +90,7 @@ public function showForm(array $options): void {
$this->question->fields['_tree_root_selectable'] = $decodedValues['selectable_tree_root'] ?? '0';
$this->question->fields['_tree_max_depth'] = $decodedValues['show_tree_depth'] ?? Dropdown::EMPTY_VALUE;
$this->question->fields['_show_ticket_categories'] = isset($decodedValues['show_ticket_categories']) ? $decodedValues['show_ticket_categories'] : 'both';
$this->question->fields['_show_service_level_types'] = isset($decodedValues['show_service_level_types']) ? $decodedValues['show_service_level_types'] : SLM::TTO;
$this->question->fields['_entity_restrict'] = $decodedValues['entity_restrict'] ?? self::ENTITY_RESTRICT_FORM;
$this->question->fields['_is_tree'] = '0';
$this->question->fields['_is_entity_restrict'] = '0';
Expand Down Expand Up @@ -514,8 +516,8 @@ public function prepareQuestionInputForSave($input) {
} else if ($input['itemtype'] == SLA::getType()
|| $input['itemtype'] == OLA::getType()
) {
$input['values']['show_service_level_types'] = $input['show_service_level_types'];
unset($input['show_service_level_types']);
$input['values']['show_service_level_types'] = $input['_show_service_level_types'];
unset($input['_show_service_level_types']);
}

// Params for entity restrictables itemtypes
Expand Down
19 changes: 19 additions & 0 deletions templates/field/dropdownfield.html.twig
Expand Up @@ -99,6 +99,25 @@
}) }}
{% endif %}

{% if item.fields['itemtype'] is defined and (item.fields['itemtype'] == 'SLA' or item.fields['itemtype'] == 'OLA' ) %}
{# keys are SLM:TTR, SLM::TTO #}
{{ fields.dropdownArrayField(
'_show_service_level_types',
item.fields['_show_service_level_types'],
{
0: __('Time to resolve', 'formcreator'),
1: __('Time to own', 'formcreator'),
},
__('Type', 'formcreator')
) }}

{{ fields.nullField({
label_class: 'col-xxl-4',
input_class: 'col-xxl-8',
}) }}
{% endif %}


{# _is_tree is set in the showForm method, and helps to find if the itemtype is a tree #}
{% if item.fields['_is_tree'] == '1' %}

Expand Down

0 comments on commit e4c6ffe

Please sign in to comment.