Enable tracker update on issue edit form (#2405).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3108 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-11-29 19:46:40 +00:00
parent 3d317a435b
commit 88fcf484d4
7 changed files with 118 additions and 47 deletions
+12
View File
@@ -127,6 +127,11 @@ class Issue < ActiveRecord::Base
self.priority = nil
write_attribute(:priority_id, pid)
end
def tracker_id=(tid)
self.tracker = nil
write_attribute(:tracker_id, tid)
end
def estimated_hours=(h)
write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
@@ -152,6 +157,13 @@ class Issue < ActiveRecord::Base
errors.add_to_base I18n.t(:error_can_not_reopen_issue_on_closed_version)
end
end
# Checks that the issue can not be added/moved to a disabled tracker
if project && (tracker_id_changed? || project_id_changed?)
unless project.trackers.include?(tracker)
errors.add :tracker_id, :inclusion
end
end
end
def validate_on_create