Fixes #3851 - Default values of new group dialog is different in german vs. english.

This commit is contained in:
Rolf Schmidt 2021-11-16 13:14:22 +01:00
parent 9e128bf74b
commit 3fdbd59b20
3 changed files with 62 additions and 5 deletions

View 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

View file

@ -1691,12 +1691,12 @@ ObjectManager::Attribute.add(
screens: { screens: {
create: { create: {
'-all-' => { '-all-' => {
null: true, null: false,
}, },
}, },
edit: { edit: {
'-all-' => { '-all-' => {
null: true, null: false,
}, },
}, },
}, },
@ -1713,7 +1713,7 @@ ObjectManager::Attribute.add(
display: __('Assign Follow-Ups'), display: __('Assign Follow-Ups'),
data_type: 'select', data_type: 'select',
data_option: { data_option: {
default: 'yes', default: 'true',
options: { options: {
true: 'yes', true: 'yes',
false: 'no', false: 'no',
@ -1727,12 +1727,12 @@ ObjectManager::Attribute.add(
screens: { screens: {
create: { create: {
'-all-' => { '-all-' => {
null: true, null: false,
}, },
}, },
edit: { edit: {
'-all-' => { '-all-' => {
null: true, null: false,
}, },
}, },
}, },

View 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