diff --git a/app/models/projects/custom_fields.rb b/app/models/projects/custom_fields.rb index 8ae6368f04d6..c939af9fb101 100644 --- a/app/models/projects/custom_fields.rb +++ b/app/models/projects/custom_fields.rb @@ -42,7 +42,7 @@ def available_custom_fields 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 @@ def all_visible_custom_fields 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