summaryrefslogtreecommitdiffstats
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index d4af06ca1..4b9812ba4 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -883,6 +883,17 @@ class Project < ActiveRecord::Base
end
end
+ # Overrides Redmine::Acts::Customizable::InstanceMethods#validate_custom_field_values
+ # so that custom values that are not editable are not validated (eg. a custom field that
+ # is marked as required should not trigger a validation error if the user is not allowed
+ # to edit this field).
+ def validate_custom_field_values
+ user = User.current
+ if new_record? || custom_field_values_changed?
+ editable_custom_field_values(user).each(&:validate_value)
+ end
+ end
+
# Returns the custom_field_values that can be edited by the given user
def editable_custom_field_values(user=nil)
visible_custom_field_values(user)