]> source.dussan.org Git - redmine.git/commitdiff
Fixed that copying issues always copy subtasks and attachments even if option is...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 23 May 2015 07:08:53 +0000 (07:08 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 23 May 2015 07:08:53 +0000 (07:08 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@14268 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 4525aa390a089bcd90ade89b43582336467d0ca6..2f7aa5315a759521a9c7e0856812ba38f1baf2b9 100644 (file)
@@ -248,7 +248,10 @@ class IssuesController < ApplicationController
   def bulk_update
     @issues.sort!
     @copy = params[:copy].present?
+
     attributes = parse_params_for_bulk_issue_attributes(params)
+    copy_subtasks = (params[:copy_subtasks] == '1')
+    copy_attachments = (params[:copy_attachments] == '1')
 
     if @copy
       unless User.current.allowed_to?(:copy_issues, @projects)
@@ -266,7 +269,7 @@ class IssuesController < ApplicationController
     unsaved_issues = []
     saved_issues = []
 
-    if @copy && params[:copy_subtasks].present?
+    if @copy && copy_subtasks
       # Descendant issues will be copied with the parent task
       # Don't copy them twice
       @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}}
@@ -276,8 +279,8 @@ class IssuesController < ApplicationController
       orig_issue.reload
       if @copy
         issue = orig_issue.copy({},
-          :attachments => params[:copy_attachments].present?,
-          :subtasks => params[:copy_subtasks].present?,
+          :attachments => copy_attachments,
+          :subtasks => copy_subtasks,
           :link => link_copy?(params[:link_copy])
         )
       else
index c3ebaf4a306849dc876ad5515fc45ea302bb2ee0..f4403e89348d390e251c1283e0e3780beef0f496 100644 (file)
@@ -4025,7 +4025,7 @@ class IssuesControllerTest < ActionController::TestCase
 
     assert_difference 'Issue.count', 1 do
       assert_no_difference 'Attachment.count' do
-        post :bulk_update, :ids => [3], :copy => '1',
+        post :bulk_update, :ids => [3], :copy => '1', :copy_attachments => '0',
              :issue => {
                :project_id => ''
              }
@@ -4066,7 +4066,7 @@ class IssuesControllerTest < ActionController::TestCase
     @request.session[:user_id] = 2
 
     assert_difference 'Issue.count', 1 do
-      post :bulk_update, :ids => [issue.id], :copy => '1',
+      post :bulk_update, :ids => [issue.id], :copy => '1', :copy_subtasks => '0',
            :issue => {
              :project_id => ''
            }