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 %>
+ +
+ + +