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