diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-02-20 15:38:07 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-02-20 15:38:07 +0000 |
commit | 4b096e9a56768dd5ba15304a903939f4e5e62e22 (patch) | |
tree | 032fb0361f6834929b0509a575ec1abcd7ba9da8 /app/controllers | |
parent | 7ddb1c694aaee2c36b0e3e67043f626903e0c961 (diff) | |
download | redmine-4b096e9a56768dd5ba15304a903939f4e5e62e22.tar.gz redmine-4b096e9a56768dd5ba15304a903939f4e5e62e22.zip |
Allow additional workflow transitions for issue author and assignee (#2732).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4895 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/workflows_controller.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb index ed4640129..9ca1a98c4 100644 --- a/app/controllers/workflows_controller.rb +++ b/app/controllers/workflows_controller.rb @@ -32,14 +32,17 @@ class WorkflowsController < ApplicationController if request.post? Workflow.destroy_all( ["role_id=? and tracker_id=?", @role.id, @tracker.id]) - (params[:issue_status] || []).each { |old, news| - news.each { |new| - @role.workflows.build(:tracker_id => @tracker.id, :old_status_id => old, :new_status_id => new) + (params[:issue_status] || []).each { |status_id, transitions| + transitions.each { |new_status_id, options| + author = options.is_a?(Array) && options.include?('author') && !options.include?('always') + assignee = options.is_a?(Array) && options.include?('assignee') && !options.include?('always') + @role.workflows.build(:tracker_id => @tracker.id, :old_status_id => status_id, :new_status_id => new_status_id, :author => author, :assignee => assignee) } } if @role.save flash[:notice] = l(:notice_successful_update) redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker + return end end @@ -48,6 +51,14 @@ class WorkflowsController < ApplicationController @statuses = @tracker.issue_statuses end @statuses ||= IssueStatus.find(:all, :order => 'position') + + if @tracker && @role && @statuses.any? + workflows = Workflow.all(:conditions => {:role_id => @role.id, :tracker_id => @tracker.id}) + @workflows = {} + @workflows['always'] = workflows.select {|w| !w.author && !w.assignee} + @workflows['author'] = workflows.select {|w| w.author} + @workflows['assignee'] = workflows.select {|w| w.assignee} + end end def copy |