Fixes #3781 - ObjectManager Attribute without screen attribute causes CoreWorkflows migration to fail
This commit is contained in:
parent
ff03e664db
commit
07c6bdacfb
2 changed files with 10 additions and 0 deletions
|
@ -75,6 +75,8 @@ class InitCoreWorkflow < ActiveRecord::Migration[5.2]
|
||||||
|
|
||||||
def fix_pending_time
|
def fix_pending_time
|
||||||
pending_time = ObjectManager::Attribute.find_by(name: 'pending_time', object_lookup: ObjectLookup.find_by(name: 'Ticket'))
|
pending_time = ObjectManager::Attribute.find_by(name: 'pending_time', object_lookup: ObjectLookup.find_by(name: 'Ticket'))
|
||||||
|
return if pending_time.blank?
|
||||||
|
|
||||||
pending_time.data_option.delete('required_if')
|
pending_time.data_option.delete('required_if')
|
||||||
pending_time.data_option.delete('shown_if')
|
pending_time.data_option.delete('shown_if')
|
||||||
pending_time.save
|
pending_time.save
|
||||||
|
@ -83,6 +85,8 @@ class InitCoreWorkflow < ActiveRecord::Migration[5.2]
|
||||||
def fix_organization_screens
|
def fix_organization_screens
|
||||||
%w[domain note].each do |name|
|
%w[domain note].each do |name|
|
||||||
field = ObjectManager::Attribute.find_by(name: name, object_lookup: ObjectLookup.find_by(name: 'Organization'))
|
field = ObjectManager::Attribute.find_by(name: name, object_lookup: ObjectLookup.find_by(name: 'Organization'))
|
||||||
|
next if field.blank?
|
||||||
|
|
||||||
field.screens['create'] ||= {}
|
field.screens['create'] ||= {}
|
||||||
field.screens['create']['-all-'] ||= {}
|
field.screens['create']['-all-'] ||= {}
|
||||||
field.screens['create']['-all-']['null'] = true
|
field.screens['create']['-all-']['null'] = true
|
||||||
|
@ -93,6 +97,8 @@ class InitCoreWorkflow < ActiveRecord::Migration[5.2]
|
||||||
def fix_user_screens
|
def fix_user_screens
|
||||||
%w[email web phone mobile organization_id fax department street zip city country address password vip note role_ids].each do |name|
|
%w[email web phone mobile organization_id fax department street zip city country address password vip note role_ids].each do |name|
|
||||||
field = ObjectManager::Attribute.find_by(name: name, object_lookup: ObjectLookup.find_by(name: 'User'))
|
field = ObjectManager::Attribute.find_by(name: name, object_lookup: ObjectLookup.find_by(name: 'User'))
|
||||||
|
next if field.blank?
|
||||||
|
|
||||||
field.screens['create'] ||= {}
|
field.screens['create'] ||= {}
|
||||||
field.screens['create']['-all-'] ||= {}
|
field.screens['create']['-all-'] ||= {}
|
||||||
field.screens['create']['-all-']['null'] = true
|
field.screens['create']['-all-']['null'] = true
|
||||||
|
|
|
@ -11,6 +11,8 @@ class Issue3751MissingWorkflowScreens < ActiveRecord::Migration[6.0]
|
||||||
def fix_organization_screens_create
|
def fix_organization_screens_create
|
||||||
%w[name shared domain_assignment active].each do |name|
|
%w[name shared domain_assignment active].each do |name|
|
||||||
field = ObjectManager::Attribute.find_by(name: name, object_lookup: ObjectLookup.find_by(name: 'Organization'))
|
field = ObjectManager::Attribute.find_by(name: name, object_lookup: ObjectLookup.find_by(name: 'Organization'))
|
||||||
|
next if field.blank?
|
||||||
|
|
||||||
field.screens['create'] ||= {}
|
field.screens['create'] ||= {}
|
||||||
field.screens['create']['-all-'] ||= {}
|
field.screens['create']['-all-'] ||= {}
|
||||||
field.screens['create']['-all-']['null'] = false
|
field.screens['create']['-all-']['null'] = false
|
||||||
|
@ -21,6 +23,8 @@ class Issue3751MissingWorkflowScreens < ActiveRecord::Migration[6.0]
|
||||||
def fix_user_screens_create
|
def fix_user_screens_create
|
||||||
%w[firstname lastname active].each do |name|
|
%w[firstname lastname active].each do |name|
|
||||||
field = ObjectManager::Attribute.find_by(name: name, object_lookup: ObjectLookup.find_by(name: 'User'))
|
field = ObjectManager::Attribute.find_by(name: name, object_lookup: ObjectLookup.find_by(name: 'User'))
|
||||||
|
next if field.blank?
|
||||||
|
|
||||||
field.screens['create'] ||= {}
|
field.screens['create'] ||= {}
|
||||||
field.screens['create']['-all-'] ||= {}
|
field.screens['create']['-all-'] ||= {}
|
||||||
field.screens['create']['-all-']['null'] = false
|
field.screens['create']['-all-']['null'] = false
|
||||||
|
|
Loading…
Reference in a new issue