OSDN Git Service

Enhanced the Issue Bulk Copy feature:
[redminele/redmine.git] / app / models / workflow.rb
index 4168fde..a96abaf 100644 (file)
@@ -40,4 +40,15 @@ class Workflow < ActiveRecord::Base
     
     result
   end
+
+  # Find potential statuses the user could be allowed to switch issues to
+  def self.available_statuses(project, user=User.current)
+    Workflow.find(:all,
+                  :include => :new_status,
+                  :conditions => {:role_id => user.roles_for_project(project).collect(&:id)}).
+      collect(&:new_status).
+      compact.
+      uniq.
+      sort
+  end
 end