Project

General

Profile

Defect #8359 ยป issue_8359.patch

Alexander Kriventsov, 2012-05-05 16:29

View differences:

app/controllers/issue_moves_controller.rb 2012-05-05 14:18:06.000000000 +0000
68 68
    @allowed_projects = Issue.allowed_target_projects_on_move
69 69
    @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
70 70
    @target_project ||= @project
71
    @trackers = @target_project.trackers
72
    @available_statuses = Workflow.available_statuses(@project)
71
    same_trackers = 1
72
    same_statuses = 1
73
    if (@issues.size > 1)
74
      @issues.each do |issue|
75
        if (issue.tracker.name != @issues.first.tracker.name) 
76
          same_trackers = 0
77
          break
78
        end
79
        if (issue.status.name != @issues.first.status.name)
80
          same_statuses = 0
81
          break
82
        end
83
      end
84
    end
85
    if (same_trackers == 1)
86
      @trackers = @target_project.trackers
87
      @target_tracker = @target_project.trackers.find_by_id(params[:new_tracker_id]) if params[:new_tracker_id]
88
      @target_tracker ||= @issues.first.tracker
89
      @target_tracker_id = params[:new_tracker_id]
90
      @target_tracker_id ||= @target_tracker.id
91
    else
92
      @target_tracker = []
93
    end
94
    if ( (same_statuses == 1) and (@target_tracker != nil) ) 
95
      @available_statuses = @issues.first.status.find_new_statuses_allowed_to(User.current.roles_for_project(@target_project), @target_tracker)
96
    else
97
      @available_statuses = []
98
    end
73 99
    @notes = params[:notes]
74 100
    @notes ||= ''
75 101
  end
76
-- app/views/issue_moves/new.html.erb.orig	2012-05-05 11:08:58.000000000 +0000
102
++ app/views/issue_moves/new.html.erb	2012-05-05 13:56:02.000000000 +0000
......
23 23
                                            :with => "Form.serialize('move_form')") %></p>
24 24

  
25 25
<p><label for="new_tracker_id"><%=l(:field_tracker)%>:</label>
26
<%= select_tag "new_tracker_id", "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@trackers, "id", "name") %></p>
26
<% if @trackers.nil? %>
27
<%= select_tag('status_id', "<option value=\"\">#{l(:label_no_change_option)}</option>") %></p>
28
<% else %>
29
<%= select_tag "new_tracker_id",
30
               options_from_collection_for_select(@trackers, "id", "name", Integer(@target_tracker_id)),
31
               :onchange => remote_function(:url => { :action => 'new' },
32
                                            :method => :get,
33
                                            :update => 'content',
34
                                            :with => "Form.serialize('move_form')") %></p>
35
<% end %>
27 36

  
28 37
<p>
29 38
  <label for='status_id'><%= l(:field_status) %></label>
39
  <% if @available_statuses.nil? %>
40
  <%= select_tag('status_id', "<option value=\"\">#{l(:label_no_change_option)}</option>") %>
41
  <% else %>
30 42
  <%= select_tag('status_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_statuses, :id, :name)) %>
43
  <% end %>
31 44
</p>
32 45

  
33 46
<p>
    (1-1/1)