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

[#64348] Take formula cfs directly from formula

Tobias Dillmann3ae1592b80ba
diff --git a/app/models/custom_field/calculated_value.rb b/app/models/custom_field/calculated_value.rb
index 790da496ffe..9fcfd3e0038 100644
--- a/app/models/custom_field/calculated_value.rb
+++ b/app/models/custom_field/calculated_value.rb
@@ -84,7 +84,7 @@ module CustomField::CalculatedValue
# We can only validate used custom fields from a high-level perspective, since at this point in validation,
# we do not have a project context to check against. So we cannot check if the custom fields are actually
# enabled for a project and visible to a non-admin user.
- formula_cfs = CustomField.where(id: cf_ids_used_in_formula(formula_string)).pluck(:id)
+ formula_cfs = cf_ids_used_in_formula(formula_string)
allowed_cfs = usable_custom_field_references_for_formula.pluck(:id)
surplus_cfs = formula_cfs - allowed_cfs