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

validate that multi_value is not set unless multi_value_possible? and allow_non_open_versions unless allow_non_open_versions_possible?

Ivan Kuchine0c43c463088
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index 98e32171b93..b7861808b01 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -69,6 +69,9 @@ class CustomField < ApplicationRecord
validates :min_length, numericality: { less_than_or_equal_to: :max_length, message: :smaller_than_or_equal_to_max_length },
unless: Proc.new { |cf| cf.max_length.blank? }
+ validates :multi_value, absence: true, unless: :multi_value_possible?
+ validates :allow_non_open_versions, absence: true, unless: :allow_non_open_versions_possible?
+
before_validation :check_searchability
after_destroy :destroy_help_text