Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#49619] Remove custom field from all type configurations leaves them active in project, shown in bulk edit

Dombi Attilae3251a256463
diff --git a/app/controllers/work_packages/bulk_controller.rb b/app/controllers/work_packages/bulk_controller.rb
index 4bf0a689fd5..b0495d346c5 100644
--- a/app/controllers/work_packages/bulk_controller.rb
+++ b/app/controllers/work_packages/bulk_controller.rb
@@ -85,9 +85,13 @@ class WorkPackages::BulkController < ApplicationController
def setup_edit
@available_statuses = @projects.map { |p| Workflow.available_statuses(p) }.inject(&:&)
- @custom_fields = @projects.map(&:all_work_package_custom_fields).inject(&:&)
@assignables = @responsibles = Principal.possible_assignee(@projects)
@types = @projects.map(&:types).inject(&:&)
+
+ # Display only the custom fields that are enabled on the projects and on types too.
+ @custom_fields =
+ @projects.map(&:all_work_package_custom_fields).inject(&:&) &
+ WorkPackageCustomField.joins(:types).where(types: @types)
end
def destroy_work_packages(work_packages)