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

Check visibility on required custom fields

Oliver Güntherc82e4ea5a075
diff --git a/app/models/projects/custom_fields.rb b/app/models/projects/custom_fields.rb
index 8ae6368f04d..c939af9fb10 100644
--- a/app/models/projects/custom_fields.rb
+++ b/app/models/projects/custom_fields.rb
@@ -42,7 +42,7 @@ module Projects::CustomFields
return all_visible_custom_fields if new_record?
all_visible_custom_fields.where(id: project_custom_field_project_mappings.select(:custom_field_id))
- .or(ProjectCustomField.required)
+ .or(required_visible_custom_fields)
end
# Note:
@@ -64,6 +64,10 @@ module Projects::CustomFields
all_available_custom_fields.visible(project: self)
end
+ def required_visible_custom_fields
+ ProjectCustomField.required.visible(project: self)
+ end
+
def custom_field_values_to_validate
# Limit the set of available custom fields when the validation is limited to a section
if _limit_custom_fields_validation_to_section_id