Fixes #3807 - Remove changes of 05a471f90d because they are not working as expected.

This commit is contained in:
Rolf Schmidt 2021-10-20 15:48:33 +01:00
parent d4dfd750b7
commit de9bb8bda9
2 changed files with 9 additions and 36 deletions

View file

@ -206,22 +206,13 @@ class App.TicketOverview extends App.Controller
article: article
)
ticket.article = article
ticket.ajax().update(
ticket.attributes()
# this option will prevent callbacks and invalid data states in case of an error
failResponseNoTrigger: true
ticket.save(
done: (r) =>
@batchCountIndex++
# refresh view after all tickets are proceeded
if @batchCountIndex == @batchCount
App.Event.trigger('overview:fetch')
fail: (record, settings, details) ->
console.log('record, settings, details', record, settings, details)
App.Event.trigger('notify', {
type: 'error'
msg: App.i18n.translateContent('Bulk action stopped %s!', error)
})
)
return
@ -234,21 +225,13 @@ class App.TicketOverview extends App.Controller
ticket.owner_id = id
if !_.isEmpty(groupId)
ticket.group_id = groupId
ticket.ajax().update(
ticket.attributes()
# this option will prevent callbacks and invalid data states in case of an error
failResponseNoTrigger: true
ticket.save(
done: (r) =>
@batchCountIndex++
# refresh view after all tickets are proceeded
if @batchCountIndex == @batchCount
App.Event.trigger('overview:fetch')
fail: (record, settings, details) ->
App.Event.trigger('notify', {
type: 'error'
msg: App.i18n.translateContent('Bulk action stopped %s!', settings.error)
})
)
return
@ -259,21 +242,13 @@ class App.TicketOverview extends App.Controller
#console.log "perform action #{action} with id #{id} on ", $(item).val()
ticket = App.Ticket.find($(item).val())
ticket.group_id = id
ticket.ajax().update(
ticket.attributes()
# this option will prevent callbacks and invalid data states in case of an error
failResponseNoTrigger: true
ticket.save(
done: (r) =>
@batchCountIndex++
# refresh view after all tickets are proceeded
if @batchCountIndex == @batchCount
App.Event.trigger('overview:fetch')
fail: (record, settings, details) ->
App.Event.trigger('notify', {
type: 'error'
msg: App.i18n.translateContent('Bulk action stopped %s!', error)
})
)
return

View file

@ -234,12 +234,11 @@ class Singleton extends Base
failResponse: (options) =>
(xhr, statusText, error, settings) =>
if options.failResponseNoTrigger isnt true
switch settings.type
when 'POST' then @createFailed()
when 'DELETE' then @destroyFailed()
# add errors to calllback
@record.trigger('ajaxError', @record, xhr, statusText, error, settings)
switch settings.type
when 'POST' then @createFailed()
when 'DELETE' then @destroyFailed()
# add errors to calllback
@record.trigger('ajaxError', @record, xhr, statusText, error, settings)
#options.fail?.call(@record, settings)
detailsRaw = xhr.responseText
@ -247,8 +246,7 @@ class Singleton extends Base
details = JSON.parse(detailsRaw)
options.fail?.call(@record, settings, details)
if options.failResponseNoTrigger isnt true
@record.trigger('destroy', @record)
@record.trigger('destroy', @record)
# /add errors to calllback
createFailed: ->