comparison app/controllers/workflows_controller.rb @ 1295:622f24f53b42 redmine-2.3

Update to Redmine SVN revision 11972 on 2.3-stable branch
author Chris Cannam
date Fri, 14 Jun 2013 09:02:21 +0100
parents 433d4f72a19b
children e248c7af89ec
comparison
equal deleted inserted replaced
1294:3e4c3460b6ca 1295:622f24f53b42
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
36 assignee = options.is_a?(Array) && options.include?('assignee') && !options.include?('always') 36 assignee = options.is_a?(Array) && options.include?('assignee') && !options.include?('always')
37 WorkflowTransition.create(:role_id => @role.id, :tracker_id => @tracker.id, :old_status_id => status_id, :new_status_id => new_status_id, :author => author, :assignee => assignee) 37 WorkflowTransition.create(:role_id => @role.id, :tracker_id => @tracker.id, :old_status_id => status_id, :new_status_id => new_status_id, :author => author, :assignee => assignee)
38 } 38 }
39 } 39 }
40 if @role.save 40 if @role.save
41 redirect_to :action => 'edit', :role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only] 41 redirect_to workflows_edit_path(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
42 return 42 return
43 end 43 end
44 end 44 end
45 45
46 @used_statuses_only = (params[:used_statuses_only] == '0' ? false : true) 46 @used_statuses_only = (params[:used_statuses_only] == '0' ? false : true)
62 @role = Role.find_by_id(params[:role_id]) if params[:role_id] 62 @role = Role.find_by_id(params[:role_id]) if params[:role_id]
63 @tracker = Tracker.find_by_id(params[:tracker_id]) if params[:tracker_id] 63 @tracker = Tracker.find_by_id(params[:tracker_id]) if params[:tracker_id]
64 64
65 if request.post? && @role && @tracker 65 if request.post? && @role && @tracker
66 WorkflowPermission.replace_permissions(@tracker, @role, params[:permissions] || {}) 66 WorkflowPermission.replace_permissions(@tracker, @role, params[:permissions] || {})
67 redirect_to :action => 'permissions', :role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only] 67 redirect_to workflows_permissions_path(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
68 return 68 return
69 end 69 end
70 70
71 @used_statuses_only = (params[:used_statuses_only] == '0' ? false : true) 71 @used_statuses_only = (params[:used_statuses_only] == '0' ? false : true)
72 if @tracker && @used_statuses_only && @tracker.issue_statuses.any? 72 if @tracker && @used_statuses_only && @tracker.issue_statuses.any?
104 @target_roles = params[:target_role_ids].blank? ? nil : Role.find_all_by_id(params[:target_role_ids]) 104 @target_roles = params[:target_role_ids].blank? ? nil : Role.find_all_by_id(params[:target_role_ids])
105 105
106 if request.post? 106 if request.post?
107 if params[:source_tracker_id].blank? || params[:source_role_id].blank? || (@source_tracker.nil? && @source_role.nil?) 107 if params[:source_tracker_id].blank? || params[:source_role_id].blank? || (@source_tracker.nil? && @source_role.nil?)
108 flash.now[:error] = l(:error_workflow_copy_source) 108 flash.now[:error] = l(:error_workflow_copy_source)
109 elsif @target_trackers.nil? || @target_roles.nil? 109 elsif @target_trackers.blank? || @target_roles.blank?
110 flash.now[:error] = l(:error_workflow_copy_target) 110 flash.now[:error] = l(:error_workflow_copy_target)
111 else 111 else
112 WorkflowRule.copy(@source_tracker, @source_role, @target_trackers, @target_roles) 112 WorkflowRule.copy(@source_tracker, @source_role, @target_trackers, @target_roles)
113 flash[:notice] = l(:notice_successful_update) 113 flash[:notice] = l(:notice_successful_update)
114 redirect_to :action => 'copy', :source_tracker_id => @source_tracker, :source_role_id => @source_role 114 redirect_to workflows_copy_path(:source_tracker_id => @source_tracker, :source_role_id => @source_role)
115 end 115 end
116 end 116 end
117 end 117 end
118 118
119 private 119 private