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
|
||||
|
||||
filter = _.clone(attribute.filter)
|
||||
if !attribute.rejectNonExistentValues && params[ attribute.name ] && !_.contains(filter, params[ attribute.name ])
|
||||
filter.push(params[ attribute.name ])
|
||||
|
||||
# check all records
|
||||
for record in App[ attribute.relation ].search(sortBy: attribute.sortBy, translate: attribute.translate)
|
||||
|
||||
# check all filter attributes
|
||||
for key in attribute.filter
|
||||
for key in filter
|
||||
|
||||
# check all filter values as array
|
||||
# if it's matching, use it for selection
|
||||
if record['id'] is key || ( record['id'] && key && record['id'].toString() is key.toString() )
|
||||
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
|
||||
else
|
||||
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(: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}"
|
||||
|
||||
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
|
||||
|
||||
|
@ -935,7 +935,7 @@ RSpec.describe 'Ticket zoom', type: :system do
|
|||
let(:user) { create(:agent, groups: [permitted_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'
|
||||
|
||||
await_empty_ajax_queue
|
||||
|
|
Loading…
Reference in a new issue