Fixes #3710 - Unable to close tickets in certran cases if core workflow is used.
This commit is contained in:
parent
96c126aca3
commit
7de423517e
2 changed files with 28 additions and 0 deletions
|
@ -50,6 +50,7 @@ module ChecksCoreWorkflow
|
||||||
|
|
||||||
def check_mandatory(perform_result)
|
def check_mandatory(perform_result)
|
||||||
perform_result[:mandatory].each_key do |key|
|
perform_result[:mandatory].each_key do |key|
|
||||||
|
next if perform_result[:visibility][key] != 'show'
|
||||||
next if !perform_result[:mandatory][key]
|
next if !perform_result[:mandatory][key]
|
||||||
next if self[key].present?
|
next if self[key].present?
|
||||||
|
|
||||||
|
|
|
@ -91,4 +91,31 @@ RSpec.shared_examples 'ChecksCoreWorkflow' do
|
||||||
expect { ticket }.to raise_error(Exceptions::UnprocessableEntity, "Missing required value for field 'pending_time'!")
|
expect { ticket }.to raise_error(Exceptions::UnprocessableEntity, "Missing required value for field 'pending_time'!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when creation of mandatory field but hidden' do
|
||||||
|
subject(:ticket) { create(:ticket, group: agent_group, screen: 'create_middle', state: Ticket::State.find_by(name: 'open')) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
create(:core_workflow,
|
||||||
|
object: 'Ticket',
|
||||||
|
perform: {
|
||||||
|
'ticket.pending_time': {
|
||||||
|
operator: 'set_mandatory',
|
||||||
|
set_mandatory: true
|
||||||
|
},
|
||||||
|
})
|
||||||
|
create(:core_workflow,
|
||||||
|
object: 'Ticket',
|
||||||
|
perform: {
|
||||||
|
'ticket.pending_time': {
|
||||||
|
operator: 'hide',
|
||||||
|
hide: true
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does create a ticket without pending_time value' do
|
||||||
|
expect { ticket }.not_to raise_error
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue