Fixed issue #1322 - Customer response via note does not trigger escalation.

This commit is contained in:
Rolf Schmidt 2018-02-07 11:46:17 +01:00
parent d33c80bbaa
commit 2f0f704ddf
2 changed files with 135 additions and 0 deletions

View file

@ -558,6 +558,10 @@ class App.TicketZoom extends App.Controller
# update changes in ui
currentStore = @currentStore()
modelDiff = @formDiff(currentParams, currentStore)
# set followup state if needed
@setDefaultFollowUpState(modelDiff, currentStore)
@markFormDiff(modelDiff)
@taskUpdateAll(modelDiff)
@ -582,6 +586,43 @@ class App.TicketZoom extends App.Controller
currentStore
setDefaultFollowUpState: (modelDiff, currentStore) ->
# if the default state is set
# and the body get changed to empty
# then we want to reset the state
if @isDefaultFollowUpStateSet && !modelDiff.article.body
@$('.sidebar select[name=state_id]').val(currentStore.ticket.state_id).trigger('change')
@isDefaultFollowUpStateSet = false
return
# set default if body is filled
return if !modelDiff.article.body
# and state got not changed
return if modelDiff.ticket.state_id
# and we are in the customer interface
return if !@permissionCheck('ticket.customer')
# and the default is was not set before
return if @isDefaultFollowUpStateSet
# prevent multiple changes for the default follow up state
@isDefaultFollowUpStateSet = true
# get state
state = App.TicketState.findByAttribute('default_follow_up', true)
# change ui and trigger change
if state
@$('.sidebar[data-tab=ticket] select[name=state_id]').val(state.id).trigger('change')
true
resetDefaultFollowUpState: ->
@isDefaultFollowUpStateSet = false
formCurrent: =>
currentParams =
ticket: @formParam(@el.find('.edit'))
@ -596,6 +637,10 @@ class App.TicketZoom extends App.Controller
# remove not needed attributes
delete currentParams.article.form_id
if @permissionCheck('ticket.customer')
currentParams.article.internal = ''
currentParams
formDiff: (currentParams, currentStore) ->
@ -867,6 +912,9 @@ class App.TicketZoom extends App.Controller
# reset task
@taskReset()
# reset default follow up state
@resetDefaultFollowUpState()
# reset/delete uploaded attachments
App.Ajax.request(
type: 'DELETE'

View file

@ -64,5 +64,92 @@ class CustomerTicketCreateTest < TestCase
css: '.content.active div.ticket-article',
value: 'some body 1234 äöüß',
)
# now we want to verify the default followup state
# for this case we close the ticket first and then
# write a new article. If the content is written
# then the state should change initially to open
# close the ticket
select(
css: '.content.active [name="state_id"]',
value: 'closed',
)
set(
css: '.content.active [data-name="body"]',
value: 'close #1',
no_click: true,
)
click(css: '.content.active .js-submit')
watch_for(
css: '.content.active div.ticket-article',
value: 'close #1',
)
# check if the ticket is closed
match(
css: '.content.active .sidebar [name="state_id"]',
value: 'closed',
)
# type in new content into rte to trigger the default follow up state
set(
css: '.content.active [data-name="body"]',
value: 'some body blublub default followup for reopen check',
no_click: true,
)
# verify if the state has changed to open
watch_for(
css: '.content.active .sidebar [name="state_id"]',
value: 'open',
)
# no we verify the reverse way:
# if the body get changed to empty again then
# the default follow up state should get unset and
# will change to the the default ticket state.
# remove content from rte
set(
css: '.content.active [data-name="body"]',
value: '',
no_click: true,
)
# check if state changed to closed again
watch_for(
css: '.content.active .sidebar [name="state_id"]',
value: 'closed',
)
# type in new content into rte to trigger the default follow up state
set(
css: '.content.active [data-name="body"]',
value: 'some body blublub default followup for reopen check',
no_click: true,
)
# verify if the state has changed to open
watch_for(
css: '.content.active .sidebar [name="state_id"]',
value: 'open',
)
# submit and reload to check if the new state is set
click(css: '.content.active .js-submit')
watch_for(
css: '.content.active div.ticket-article',
value: 'some body blublub default followup for reopen check',
)
# verify if the state has changed to open
match(
css: '.content.active .sidebar [name="state_id"]',
value: 'open',
)
end
end