mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-24 01:11:12 +00:00
Fixed that a disabled field which is required by workflow rules blocks issue creation/update (#17744).
git-svn-id: http://svn.redmine.org/redmine/trunk@13557 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
984e5a36bb
commit
4cd67587ce
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user