diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-04-22 22:20:09 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-04-22 22:20:09 +0000 |
commit | feb973b97052b80e5b85d64e05e8aca5e07a754c (patch) | |
tree | 274199ac71c3f88513d52394454b4810176eea9c /app/models/issue_status.rb | |
parent | e02068eb2a7c5fc00b00e824f342d8cebd4fff57 (diff) | |
download | redmine-feb973b97052b80e5b85d64e05e8aca5e07a754c.tar.gz redmine-feb973b97052b80e5b85d64e05e8aca5e07a754c.zip |
The ability to change the issue status to the same status is no longer forced.
This behaviour can be defined in workflow setup.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@470 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_status.rb')
-rw-r--r-- | app/models/issue_status.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/issue_status.rb b/app/models/issue_status.rb index de8a1391e..61cb3f282 100644 --- a/app/models/issue_status.rb +++ b/app/models/issue_status.rb @@ -38,16 +38,14 @@ class IssueStatus < ActiveRecord::Base # Returns an array of all statuses the given role can switch to # Uses association cache when called more than one time def new_statuses_allowed_to(role, tracker) - new_statuses = [self] - new_statuses += workflows.select {|w| w.role_id == role.id && w.tracker_id == tracker.id}.collect{|w| w.new_status} if role && tracker + new_statuses = workflows.select {|w| w.role_id == role.id && w.tracker_id == tracker.id}.collect{|w| w.new_status} if role && tracker new_statuses.sort{|x, y| x.position <=> y.position } end # Same thing as above but uses a database query # More efficient than the previous method if called just once def find_new_statuses_allowed_to(role, tracker) - new_statuses = [self] - new_statuses += workflows.find(:all, + new_statuses = workflows.find(:all, :include => :new_status, :conditions => ["role_id=? and tracker_id=?", role.id, tracker.id]).collect{ |w| w.new_status } if role && tracker new_statuses.sort{|x, y| x.position <=> y.position } |