diff -Nur redmine-1.0.4/app/controllers/issue_moves_controller.rb redmine-1.0.4-enhanced-move-copy/app/controllers/issue_moves_controller.rb --- redmine-1.0.4/app/controllers/issue_moves_controller.rb 2010-11-28 13:51:00.000000000 -0700 +++ redmine-1.0.4-enhanced-move-copy/app/controllers/issue_moves_controller.rb 2011-01-25 10:30:38.585414500 -0700 @@ -3,6 +3,9 @@ before_filter :find_issues before_filter :authorize + helper :issue_relations + include IssueRelationsHelper + def new prepare_for_issue_move render :layout => false if request.xhr? @@ -13,6 +16,7 @@ if request.post? new_tracker = params[:new_tracker_id].blank? ? nil : @target_project.trackers.find_by_id(params[:new_tracker_id]) + relation_type = params[:relation_type].blank? ? nil : params[:relation_type] unsaved_issue_ids = [] moved_issues = [] @issues.each do |issue| @@ -20,7 +24,7 @@ issue.init_journal(User.current) issue.current_journal.notes = @notes if @notes.present? call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy }) - if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params)}) + if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :relation_type => relation_type, :attributes => extract_changed_attributes_for_move(params)}) moved_issues << r else unsaved_issue_ids << issue.id @@ -51,13 +55,15 @@ @target_project ||= @project @trackers = @target_project.trackers @available_statuses = Workflow.available_statuses(@project) + @fixed_versions = @target_project.shared_versions.open + @categories = @target_project.issue_categories @notes = params[:notes] @notes ||= '' end def extract_changed_attributes_for_move(params) changed_attributes = {} - [:assigned_to_id, :status_id, :start_date, :due_date, :priority_id].each do |valid_attribute| + [:assigned_to_id, :status_id, :fixed_version_id, :category_id, :start_date, :due_date, :priority_id].each do |valid_attribute| unless params[valid_attribute].blank? changed_attributes[valid_attribute] = (params[valid_attribute] == 'none' ? nil : params[valid_attribute]) end diff -Nur redmine-1.0.4/app/models/issue.rb redmine-1.0.4-enhanced-move-copy/app/models/issue.rb --- redmine-1.0.4/app/models/issue.rb 2010-11-28 13:51:00.000000000 -0700 +++ redmine-1.0.4-enhanced-move-copy/app/models/issue.rb 2011-01-25 10:36:45.758484200 -0700 @@ -158,6 +158,16 @@ end end end + if options[:relation_type] + relation = IssueRelation.new( + :relation_type => options[:relation_type], + :issue_from => self, + :issue_to => issue) + unless relation.save + issue.destroy + return false + end + end else return false end diff -Nur redmine-1.0.4/app/views/issue_moves/new.rhtml redmine-1.0.4-enhanced-move-copy/app/views/issue_moves/new.rhtml --- redmine-1.0.4/app/views/issue_moves/new.rhtml 2010-11-28 13:51:00.000000000 -0700 +++ redmine-1.0.4-enhanced-move-copy/app/views/issue_moves/new.rhtml 2011-01-25 10:29:49.163223200 -0700 @@ -10,7 +10,10 @@ <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join %>
-

+ +

+ +

<%= select_tag "new_project_id", project_tree_options_for_select(@allowed_projects, :selected => @target_project), :onchange => remote_function(:url => { :action => 'new' }, @@ -18,9 +21,22 @@ :update => 'content', :with => "Form.serialize('move_form')") %>

-

+

<%= select_tag "new_tracker_id", "" + options_from_collection_for_select(@trackers, "id", "name") %>

+<% if @copy && (@project == @target_project || Setting.cross_project_issue_relations?) %> +

+ + <%= select_tag('relation_type', "" + options_for_select(collection_for_relation_type_select)) %> +

+<% end %> + +
+ +
<%= l(:label_attribute_plural) %> + +
+

<%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option), :value => '') + @@ -28,6 +44,24 @@ options_from_collection_for_select(@target_project.assignable_users, :id, :name)) %>

+<% if !@categories.empty? %> +

+ + <%= select_tag('category_id', "" + options_from_collection_for_select(@categories, :id, :name)) %> +

+<% end %> + +<% if !@fixed_versions.empty? %> +

+ + <%= select_tag('fixed_version_id', "" + options_from_collection_for_select(@fixed_versions, :id, :name)) %> +

+<% end %> + +
+ +
+

<%= select_tag('status_id', "" + options_from_collection_for_select(@available_statuses, :id, :name)) %> @@ -48,6 +82,9 @@ <%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>

+
+
+
<%= l(:field_notes) %> <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %> <%= wikitoolbar_for 'notes' %>