diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-12-18 15:41:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-12-18 15:41:32 +0000 |
commit | 6bf0723d0654e58bc6c8fc19759ff8fb6502a18f (patch) | |
tree | a90c2bb695ca772be91cab3fb07d79f7ea2de30d /app/models/tracker.rb | |
parent | 6a369f28ddab41673f51c1b7a640ad6054d8e258 (diff) | |
download | redmine-6bf0723d0654e58bc6c8fc19759ff8fb6502a18f.tar.gz redmine-6bf0723d0654e58bc6c8fc19759ff8fb6502a18f.zip |
By default, only show statuses that are used by the tracker on the workflow edit view.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3188 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/tracker.rb')
-rw-r--r-- | app/models/tracker.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/tracker.rb b/app/models/tracker.rb index 8f7a98c39..9ee045ce1 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -43,6 +43,23 @@ class Tracker < ActiveRecord::Base find(:all, :order => 'position') end + # Returns an array of IssueStatus that are used + # in the tracker's workflows + def issue_statuses + if @issue_statuses + return @issue_statuses + elsif new_record? + return [] + end + + ids = Workflow. + connection.select_rows("SELECT DISTINCT old_status_id, new_status_id FROM #{Workflow.table_name} WHERE tracker_id = #{id}"). + flatten. + uniq + + @issue_statuses = IssueStatus.find_all_by_id(ids).sort + end + private def check_integrity raise "Can't delete tracker" if Issue.find(:first, :conditions => ["tracker_id=?", self.id]) |