GitLab wurde erfolgreich aktualisiert. Durch regelmäßige Updates bleibt das THM GitLab sicher. Danke für Ihre Geduld.

Commit ef5772d9 authored by jplang's avatar jplang

Fixed that a disabled field which is required by workflow rules blocks issue...

Fixed that a disabled field which is required by workflow rules blocks issue creation/update (#17744).

git-svn-id: https://svn.redmine.org/redmine/trunk@13557 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 4f0f95f7
......@@ -669,7 +669,7 @@ class Issue < ActiveRecord::Base
errors.add :base, v.custom_field.name + ' ' + l('activerecord.errors.messages.blank')
end
else
if respond_to?(attribute) && send(attribute).blank?
if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute)
errors.add attribute, :blank
end
end
......
......@@ -836,6 +836,26 @@ class IssueTest < ActiveSupport::TestCase
assert issue.save
end
def test_required_attribute_that_is_disabled_for_the_tracker_should_not_be_required
WorkflowPermission.delete_all
WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
:role_id => 1, :field_name => 'start_date',
:rule => 'required')
user = User.find(2)
issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
:subject => 'Required fields', :author => user)
assert !issue.save
assert_include "Start date can't be blank", issue.errors.full_messages
tracker = Tracker.find(1)
tracker.core_fields -= %w(start_date)
tracker.save!
issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
:subject => 'Required fields', :author => user)
assert issue.save
end
def test_required_attribute_names_for_multiple_roles_should_intersect_rules
WorkflowPermission.delete_all
WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment