Fixes #5880 - Setting relative pending reminder times via macro results in an Missing required value for field pending_time! error.
Co-authored-by: Florian Liebe <fl@zammad.com>
This commit is contained in:
@@ -1157,6 +1157,7 @@ class App.TicketZoom extends App.Controller
|
||||
nextTicket = @getNextTicketInOverview()
|
||||
|
||||
removedFields = editContollerForm.removedFields(editContollerForm.elReplace)
|
||||
removedFields = _.omit(removedFields, macro.performKeys().ticket) if macro?.id # https://github.com/zammad/zammad/issues/5880
|
||||
payload = _.omit(ticket.attributes(), removedFields)
|
||||
|
||||
# Include the list of actions to perform later, if defined by macro.
|
||||
|
||||
@@ -34,3 +34,14 @@ You can use macros in Zammad to automate recurring sequences, saving time (and n
|
||||
|
||||
uiUrl: =>
|
||||
"#manage/macros/1/id:#{@id}"
|
||||
|
||||
performKeys: ->
|
||||
return if !@perform
|
||||
|
||||
result = {}
|
||||
for key, value of @perform
|
||||
attributes = key.split('.')
|
||||
result[attributes[0]] ||= []
|
||||
result[attributes[0]].push(attributes[1])
|
||||
|
||||
return result
|
||||
|
||||
@@ -2731,4 +2731,20 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||
expect(page).to have_css('#navigation .icon-status-modified-inner-circle')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Setting relative pending reminder times via macro results in an "Missing required value for field pending_time! error #5880', authenticated_as: :authenticate do
|
||||
let(:macro) { create(:macro, name: 'set custom pending', perform: { 'ticket.state_id' => { 'value' => '3' }, 'ticket.pending_time' => { 'operator' => 'relative', 'value' => '1', 'range' => 'week' } }) }
|
||||
|
||||
def authenticate
|
||||
macro
|
||||
true
|
||||
end
|
||||
|
||||
it 'does change the state via macro' do
|
||||
visit "#ticket/zoom/#{Ticket.first.id}"
|
||||
click '.js-openDropdownMacro'
|
||||
find(:macro, macro.id).click
|
||||
wait.until { Ticket.first.state.name == 'pending reminder' && Ticket.first.pending_time.present? }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user