Index: app/models/issue_relation.rb =================================================================== --- app/models/issue_relation.rb (revision 7630) +++ app/models/issue_relation.rb (working copy) @@ -26,6 +26,8 @@ TYPE_BLOCKED = "blocked" TYPE_PRECEDES = "precedes" TYPE_FOLLOWS = "follows" + TYPE_COPIES = "copied to" + TYPE_COPIED = "copied from" TYPES = { TYPE_RELATES => { :name => :label_relates_to, :sym_name => :label_relates_to, :order => 1, :sym => TYPE_RELATES }, TYPE_DUPLICATES => { :name => :label_duplicates, :sym_name => :label_duplicated_by, :order => 2, :sym => TYPE_DUPLICATED }, @@ -33,7 +35,9 @@ TYPE_BLOCKS => { :name => :label_blocks, :sym_name => :label_blocked_by, :order => 4, :sym => TYPE_BLOCKED }, TYPE_BLOCKED => { :name => :label_blocked_by, :sym_name => :label_blocks, :order => 5, :sym => TYPE_BLOCKS, :reverse => TYPE_BLOCKS }, TYPE_PRECEDES => { :name => :label_precedes, :sym_name => :label_follows, :order => 6, :sym => TYPE_FOLLOWS }, - TYPE_FOLLOWS => { :name => :label_follows, :sym_name => :label_precedes, :order => 7, :sym => TYPE_PRECEDES, :reverse => TYPE_PRECEDES } + TYPE_FOLLOWS => { :name => :label_follows, :sym_name => :label_precedes, :order => 7, :sym => TYPE_PRECEDES, :reverse => TYPE_PRECEDES }, + TYPE_COPIES => { :name => :label_copied_to, :sym_name => :label_copied_from, :order => 8, :sym => TYPE_COPIED }, + TYPE_COPIED => { :name => :label_copied_from, :sym_name => :label_copied_to, :order => 9, :sym => TYPE_COPIES, :reverse => TYPE_COPIES } }.freeze validates_presence_of :issue_from, :issue_to, :relation_type Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 7630) +++ app/models/issue.rb (working copy) @@ -208,6 +208,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 Index: app/controllers/issue_moves_controller.rb =================================================================== --- app/controllers/issue_moves_controller.rb (revision 7630) +++ app/controllers/issue_moves_controller.rb (working copy) @@ -22,6 +22,9 @@ before_filter :find_issues, :check_project_uniqueness before_filter :authorize + helper :issue_relations + include IssueRelationsHelper + def new prepare_for_issue_move render :layout => false if request.xhr? @@ -32,6 +35,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| @@ -39,7 +43,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 Index: app/views/issue_moves/new.html.erb =================================================================== --- app/views/issue_moves/new.html.erb (revision 7630) +++ app/views/issue_moves/new.html.erb (working copy) @@ -22,6 +22,14 @@ :update => 'content', :with => "Form.serialize('move_form')") %>

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

+ + <%= select_tag('relation_type', content_tag('option', l(:label_none), :value => '') + + options_for_select(collection_for_relation_type_select)) %> +

+<% end %> +

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

Index: config/locales/en.yml =================================================================== --- config/locales/en.yml (revision 7630) +++ config/locales/en.yml (working copy) @@ -714,6 +714,8 @@ label_blocked_by: blocked by label_precedes: precedes label_follows: follows + label_copied_to: copied to + label_copied_from: copied from label_end_to_start: end to start label_end_to_end: end to end label_start_to_start: start to start