@@ -669,7 +669,7 class Issue < ActiveRecord::Base | |||||
669 | errors.add :base, v.custom_field.name + ' ' + l('activerecord.errors.messages.blank') |
|
669 | errors.add :base, v.custom_field.name + ' ' + l('activerecord.errors.messages.blank') | |
670 | end |
|
670 | end | |
671 | else |
|
671 | else | |
672 | if respond_to?(attribute) && send(attribute).blank? |
|
672 | if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute) | |
673 | errors.add attribute, :blank |
|
673 | errors.add attribute, :blank | |
674 | end |
|
674 | end | |
675 | end |
|
675 | end |
@@ -836,6 +836,26 class IssueTest < ActiveSupport::TestCase | |||||
836 | assert issue.save |
|
836 | assert issue.save | |
837 | end |
|
837 | end | |
838 |
|
838 | |||
|
839 | def test_required_attribute_that_is_disabled_for_the_tracker_should_not_be_required | |||
|
840 | WorkflowPermission.delete_all | |||
|
841 | WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, | |||
|
842 | :role_id => 1, :field_name => 'start_date', | |||
|
843 | :rule => 'required') | |||
|
844 | user = User.find(2) | |||
|
845 | ||||
|
846 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1, | |||
|
847 | :subject => 'Required fields', :author => user) | |||
|
848 | assert !issue.save | |||
|
849 | assert_include "Start date can't be blank", issue.errors.full_messages | |||
|
850 | ||||
|
851 | tracker = Tracker.find(1) | |||
|
852 | tracker.core_fields -= %w(start_date) | |||
|
853 | tracker.save! | |||
|
854 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1, | |||
|
855 | :subject => 'Required fields', :author => user) | |||
|
856 | assert issue.save | |||
|
857 | end | |||
|
858 | ||||
839 | def test_required_attribute_names_for_multiple_roles_should_intersect_rules |
|
859 | def test_required_attribute_names_for_multiple_roles_should_intersect_rules | |
840 | WorkflowPermission.delete_all |
|
860 | WorkflowPermission.delete_all | |
841 | WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, |
|
861 | WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, |
General Comments 0
You need to be logged in to leave comments.
Login now