]> source.dussan.org Git - redmine.git/commitdiff
Copying an issue does not copy parent task id (#12893).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Jan 2016 15:47:52 +0000 (15:47 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Jan 2016 15:47:52 +0000 (15:47 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15058 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
test/functional/issues_controller_test.rb

index 29fc0c9f3934c9b28d0a620c1c10287672fac0cb..fa911a11b6617df1e70887e8e4d3551db83a7083 100644 (file)
@@ -415,6 +415,7 @@ class IssuesController < ApplicationController
         @copy_attachments = params[:copy_attachments].present? || request.get?
         @copy_subtasks = params[:copy_subtasks].present? || request.get?
         @issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks, :link => @link_copy)
+        @issue.parent_issue_id = @copy_from.parent_id
       rescue ActiveRecord::RecordNotFound
         render_404
         return
index 8cbd99d640f0ef78619bd9a97ca8e49708b62900..395a5615e7e79bdcc204b1693894ab1751580bb6 100644 (file)
@@ -2775,6 +2775,14 @@ class IssuesControllerTest < ActionController::TestCase
     assert_select 'input[name=copy_attachments]', 0
   end
 
+  def test_new_as_copy_should_preserve_parent_id
+    @request.session[:user_id] = 2
+    issue = Issue.generate!(:parent_issue_id => 2)
+    get :new, :project_id => 1, :copy_from => issue.id
+
+    assert_select 'input[name=?][value="2"]', 'issue[parent_issue_id]'
+  end
+
   def test_new_as_copy_with_subtasks_should_show_copy_subtasks_checkbox
     @request.session[:user_id] = 2
     issue = Issue.generate_with_descendants!