Fixes #3851 - Default values of new group dialog is different in german vs. english.
This commit is contained in:
parent
9e128bf74b
commit
3fdbd59b20
3 changed files with 62 additions and 5 deletions
25
db/migrate/20211115135421_issue3851.rb
Normal file
25
db/migrate/20211115135421_issue3851.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
class Issue3851 < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
return if !Setting.exists?(name: 'system_init_done')
|
||||
|
||||
fix_follow_up_assignment
|
||||
fix_follow_up_possible
|
||||
end
|
||||
|
||||
def fix_follow_up_assignment
|
||||
follow_up_assignment = ObjectManager::Attribute.for_object('Group').find_by(name: 'follow_up_assignment')
|
||||
follow_up_assignment.data_option['default'] = 'true'
|
||||
follow_up_assignment.screens['create']['-all-']['null'] = false
|
||||
follow_up_assignment.screens['edit']['-all-']['null'] = false
|
||||
follow_up_assignment.save!
|
||||
end
|
||||
|
||||
def fix_follow_up_possible
|
||||
follow_up_possible = ObjectManager::Attribute.for_object('Group').find_by(name: 'follow_up_possible')
|
||||
follow_up_possible.screens['create']['-all-']['null'] = false
|
||||
follow_up_possible.screens['edit']['-all-']['null'] = false
|
||||
follow_up_possible.save!
|
||||
end
|
||||
end
|
|
@ -1691,12 +1691,12 @@ ObjectManager::Attribute.add(
|
|||
screens: {
|
||||
create: {
|
||||
'-all-' => {
|
||||
null: true,
|
||||
null: false,
|
||||
},
|
||||
},
|
||||
edit: {
|
||||
'-all-' => {
|
||||
null: true,
|
||||
null: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1713,7 +1713,7 @@ ObjectManager::Attribute.add(
|
|||
display: __('Assign Follow-Ups'),
|
||||
data_type: 'select',
|
||||
data_option: {
|
||||
default: 'yes',
|
||||
default: 'true',
|
||||
options: {
|
||||
true: 'yes',
|
||||
false: 'no',
|
||||
|
@ -1727,12 +1727,12 @@ ObjectManager::Attribute.add(
|
|||
screens: {
|
||||
create: {
|
||||
'-all-' => {
|
||||
null: true,
|
||||
null: false,
|
||||
},
|
||||
},
|
||||
edit: {
|
||||
'-all-' => {
|
||||
null: true,
|
||||
null: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
32
spec/db/migrate/issue_3851_spec.rb
Normal file
32
spec/db/migrate/issue_3851_spec.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Issue3851, type: :db_migration do
|
||||
let(:follow_up_assignment) { ObjectManager::Attribute.for_object('Group').find_by(name: 'follow_up_assignment') }
|
||||
let(:follow_up_possible) { ObjectManager::Attribute.for_object('Group').find_by(name: 'follow_up_possible') }
|
||||
|
||||
before do
|
||||
migrate
|
||||
end
|
||||
|
||||
it 'shows field follow_up_assignment with correct default' do
|
||||
expect(follow_up_assignment.data_option['default']).to eq('true')
|
||||
end
|
||||
|
||||
it 'shows field follow_up_assignment required in create' do
|
||||
expect(follow_up_assignment.screens['create']['-all-']['null']).to eq(false)
|
||||
end
|
||||
|
||||
it 'shows field follow_up_assignment required in edit' do
|
||||
expect(follow_up_assignment.screens['edit']['-all-']['null']).to eq(false)
|
||||
end
|
||||
|
||||
it 'shows field follow_up_possible required in create' do
|
||||
expect(follow_up_possible.screens['create']['-all-']['null']).to eq(false)
|
||||
end
|
||||
|
||||
it 'shows field follow_up_possible required in edit' do
|
||||
expect(follow_up_possible.screens['edit']['-all-']['null']).to eq(false)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue