diff --git a/app/services/custom_fields/create_service.rb b/app/services/custom_fields/create_service.rb index 4d08c8aaba4a..f405956717ca 100644 --- a/app/services/custom_fields/create_service.rb +++ b/app/services/custom_fields/create_service.rb @@ -56,6 +56,14 @@ def after_perform(call) if cf.is_a?(ProjectCustomField) add_cf_to_visible_columns(cf) + elsif cf.field_format == "hierarchy" + # TODO: Use persistence service + CustomField::Hierarchy::Item.create(custom_field: cf, + label: nil, + parent: nil, + short: nil, + sort_order: 0) + .save end call diff --git a/lib/open_project/custom_field_format_dependent.rb b/lib/open_project/custom_field_format_dependent.rb index e307dba16abb..937920c66063 100644 --- a/lib/open_project/custom_field_format_dependent.rb +++ b/lib/open_project/custom_field_format_dependent.rb @@ -32,11 +32,11 @@ class CustomFieldFormatDependent allowNonOpenVersions: [:only, %w[version]], defaultBool: [:only, %w[bool]], defaultLongText: [:only, %w[text]], - defaultText: [:except, %w[list bool date text user version]], - length: [:except, %w[list bool date user version link]], - multiSelect: [:only, %w[list user version]], + defaultText: [:except, %w[list bool date text user version hierarchy]], + length: [:except, %w[list bool date user version link hierarchy]], + multiSelect: [:only, %w[list user version hierarchy]], possibleValues: [:only, %w[list]], - regexp: [:except, %w[list bool date user version]], + regexp: [:except, %w[list bool date user version hierarchy]], searchable: [:except, %w[bool date float int user version]], textOrientation: [:only, %w[text]] }.freeze