Fixed #3321 - Unable to unassign owner via macro or trigger.

This commit is contained in:
Martin Edenhofer 2020-12-02 09:35:59 +01:00 committed by Thorsten Eckel
parent b3b7a84683
commit 025cc8b12f
2 changed files with 63 additions and 2 deletions

View file

@ -275,12 +275,14 @@ class App.UiElement.ticket_perform_action
options =
'current_user.id': App.i18n.translateInline('current user')
'specific': App.i18n.translateInline('specific user')
#'set': App.i18n.translateInline('set')
if attributeSelected.null is true
options['not_set'] = App.i18n.translateInline('unassign user')
else if preCondition is 'org'
options =
'current_user.organization_id': App.i18n.translateInline('current user organization')
'specific': App.i18n.translateInline('specific organization')
#'set': App.i18n.translateInline('set')
for key, value of options
selected = ''

View file

@ -546,3 +546,62 @@ test( "ticket_perform_action orphan time fields", function() {
equal(el.find('.js-valueRangeSelector').length, 0)
});
test( "ticket_perform_action check possible owner selection", function() {
$('#forms').append('<hr><h1>ticket_perform_action check possible owner selection</h1><form id="form5"></form>')
var el = $('#form5')
var defaults = {
ticket_perform_action5: {
'ticket.owner_id': {
pre_condition: 'not_set',
}
}
}
new App.ControllerForm({
el: el,
model: {
configure_attributes: [
{
name: 'ticket_perform_action5',
display: 'TicketPerformAction5',
tag: 'ticket_perform_action',
null: true,
},
]
},
params: defaults,
autofocus: true
})
var params = App.ControllerForm.params(el)
var test_params = {
ticket_perform_action5: {
'ticket.owner_id': {
pre_condition: 'not_set',
value: '',
value_completion: ''
}
}
}
deepEqual(params, test_params, 'form param check')
el.find('[name="ticket_perform_action5::ticket.owner_id::pre_condition"]').val('specific').trigger('change')
params = App.ControllerForm.params(el)
test_params = {
ticket_perform_action5: {
'ticket.owner_id': {
pre_condition: 'specific',
value: '',
value_completion: ''
}
}
}
deepEqual(params, test_params, 'form param check')
});