Fixes #3335 - State list of tickets ignore locale for their sorting
This commit is contained in:
parent
30654f8d7d
commit
26b9eb0281
2 changed files with 8 additions and 14 deletions
|
@ -114,27 +114,21 @@ class App.UiElement.ApplicationUiElement
|
||||||
|
|
||||||
App.Log.debug 'ControllerForm', '_getRelationOptionList:filter-array', attribute.filter
|
App.Log.debug 'ControllerForm', '_getRelationOptionList:filter-array', attribute.filter
|
||||||
|
|
||||||
|
filter = _.clone(attribute.filter)
|
||||||
|
if !attribute.rejectNonExistentValues && params[ attribute.name ] && !_.contains(filter, params[ attribute.name ])
|
||||||
|
filter.push(params[ attribute.name ])
|
||||||
|
|
||||||
# check all records
|
# check all records
|
||||||
for record in App[ attribute.relation ].search(sortBy: attribute.sortBy, translate: attribute.translate)
|
for record in App[ attribute.relation ].search(sortBy: attribute.sortBy, translate: attribute.translate)
|
||||||
|
|
||||||
# check all filter attributes
|
# check all filter attributes
|
||||||
for key in attribute.filter
|
for key in filter
|
||||||
|
|
||||||
# check all filter values as array
|
# check all filter values as array
|
||||||
# if it's matching, use it for selection
|
# if it's matching, use it for selection
|
||||||
if record['id'] is key || ( record['id'] && key && record['id'].toString() is key.toString() )
|
if record['id'] is key || ( record['id'] && key && record['id'].toString() is key.toString() )
|
||||||
list.push record
|
list.push record
|
||||||
|
|
||||||
# check if current value need to be added
|
|
||||||
if params[ attribute.name ] && !attribute.rejectNonExistentValues
|
|
||||||
hit = false
|
|
||||||
for value in list
|
|
||||||
if value['id'].toString() is params[ attribute.name ].toString()
|
|
||||||
hit = true
|
|
||||||
if !hit
|
|
||||||
currentRecord = App[ attribute.relation ].find(params[ attribute.name ])
|
|
||||||
list.push currentRecord
|
|
||||||
|
|
||||||
# no data filter matched
|
# no data filter matched
|
||||||
else
|
else
|
||||||
App.Log.debug 'ControllerForm', '_getRelationOptionList:filter-data no filter matched'
|
App.Log.debug 'ControllerForm', '_getRelationOptionList:filter-data no filter matched'
|
||||||
|
|
|
@ -923,11 +923,11 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
let(:user) { create(:customer) }
|
let(:user) { create(:customer) }
|
||||||
let(:ticket) { create(:ticket, customer: user) }
|
let(:ticket) { create(:ticket, customer: user) }
|
||||||
|
|
||||||
it 'shows ticket state dropdown options in sorted order, with new at the end' do
|
it 'shows ticket state dropdown options in sorted order' do
|
||||||
visit "ticket/zoom/#{ticket.id}"
|
visit "ticket/zoom/#{ticket.id}"
|
||||||
|
|
||||||
await_empty_ajax_queue
|
await_empty_ajax_queue
|
||||||
expect(all('select[name=state_id] option').map(&:text)).to eq(%w[geschlossen offen neu])
|
expect(all('select[name=state_id] option').map(&:text)).to eq(%w[geschlossen neu offen])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
let(:user) { create(:agent, groups: [permitted_group]) }
|
let(:user) { create(:agent, groups: [permitted_group]) }
|
||||||
let(:permitted_group) { create(:group) }
|
let(:permitted_group) { create(:group) }
|
||||||
|
|
||||||
it 'shows ticket state dropdown options in sorted order, with new in sorted position' do
|
it 'shows ticket state dropdown options in sorted order' do
|
||||||
visit 'ticket/create'
|
visit 'ticket/create'
|
||||||
|
|
||||||
await_empty_ajax_queue
|
await_empty_ajax_queue
|
||||||
|
|
Loading…
Reference in a new issue