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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Move the set_query_available_custom_fields_to_global_level to the Projects::UpdateContract
Dombi Attila86a01bfe2ff8
diff --git a/app/models/projects/acts_as_customizable_patches.rb b/app/models/projects/acts_as_customizable_patches.rbindex b6d26e7f8a3..92467c2e30b 100644--- a/app/models/projects/acts_as_customizable_patches.rb+++ b/app/models/projects/acts_as_customizable_patches.rb@@ -39,14 +39,6 @@ module Projects::ActsAsCustomizablePatchesdependent: :destroy, inverse_of: :projecthas_many :project_custom_fields, through: :project_custom_field_project_mappings, class_name: "ProjectCustomField"- before_update :set_query_available_custom_fields_to_global_level-- def set_query_available_custom_fields_to_global_level- # query the available custom fields on a global level when updating custom field values- # in order to support implicit activation of custom fields when values are provided during an update- self._query_available_custom_fields_on_global_level = true- end-def with_all_available_custom_fields# query the available custom fields on a global level when updating custom field values# in order to support implicit activation of custom fields when values are provided during an updatediff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rbindex 3394f75973f..4a60a3c8f16 100644--- a/app/services/projects/update_service.rb+++ b/app/services/projects/update_service.rb@@ -45,6 +45,12 @@ module Projectsretend+ def after_validate(params, service_call)+ super.tap do+ set_query_available_custom_fields_to_global_level+ end+ end+def after_perform(service_call)ret = superreset_section_scoped_validation@@ -104,5 +110,11 @@ module Projects# in order not to silently carry this setting in this instancemodel._limit_custom_fields_validation_to_section_id = nilend++ def set_query_available_custom_fields_to_global_level+ # query the available custom fields on a global level when updating custom field values+ # in order to support implicit activation of custom fields when values are provided during an update+ model._query_available_custom_fields_on_global_level = true+ endendend