Skip to content

Commit

Permalink
[#57814] exclude existing hierarchy fields from config lists
Browse files Browse the repository at this point in the history
- hide hierarchy custom fields when configuring work package types
- hide hierarchy custom fields when enabling custom fields for projects
  • Loading branch information
Kharonus committed Sep 30, 2024
1 parent 91db17b commit e0097af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class Projects::Settings::CustomFieldsController < Projects::SettingsController
menu_item :settings_custom_fields

def show
@wp_custom_fields = WorkPackageCustomField.order("lower(name)")
@wp_custom_fields = WorkPackageCustomField
.order("lower(name)")
.where.not(field_format: "hierarchy") # TODO: Remove after enabling hierarchy fields
end

def update
Expand Down
4 changes: 3 additions & 1 deletion app/models/type/attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ def merge_date_for_form_attributes(attributes)
end

def add_custom_fields_to_form_attributes(attributes)
WorkPackageCustomField.includes(:custom_options).all.find_each do |field|
WorkPackageCustomField.includes(:custom_options)
.where.not(field_format: "hierarchy") # TODO: Remove after enabling hierarchy fields
.find_each do |field|
attributes[field.attribute_name] = {
required: field.is_required,
has_default: field.default_value.present?,
Expand Down

0 comments on commit e0097af

Please sign in to comment.