##// END OF EJS Templates
Fixes that issue copy/move throws an error when status is not changed (#4369)....
Jean-Philippe Lang -
r3034:7537e86fd2e4
parent child
Show More
@@ -296,7 +296,9 class IssuesController < ApplicationController
296 296 @issues.each do |issue|
297 297 changed_attributes = {}
298 298 [:assigned_to_id, :status_id, :start_date, :due_date].each do |valid_attribute|
299 changed_attributes[valid_attribute] = params[valid_attribute] if params[valid_attribute]
299 unless params[valid_attribute].blank?
300 changed_attributes[valid_attribute] = (params[valid_attribute] == 'none' ? nil : params[valid_attribute])
301 end
300 302 end
301 303 issue.init_journal(User.current)
302 304 if r = issue.move_to(@target_project, new_tracker, {:copy => @copy, :attributes => changed_attributes})
@@ -1049,7 +1049,7 class IssuesControllerTest < ActionController::TestCase
1049 1049
1050 1050 def test_move_one_issue_to_another_project
1051 1051 @request.session[:user_id] = 2
1052 post :move, :id => 1, :new_project_id => 2
1052 post :move, :id => 1, :new_project_id => 2, :tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => ''
1053 1053 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
1054 1054 assert_equal 2, Issue.find(1).project_id
1055 1055 end
@@ -1091,11 +1091,25 class IssuesControllerTest < ActionController::TestCase
1091 1091 end
1092 1092
1093 1093 context "#move via bulk copy" do
1094 should "allow not changing the issue's attributes" do
1095 @request.session[:user_id] = 2
1096 issue_before_move = Issue.find(1)
1097 assert_difference 'Issue.count', 1 do
1098 assert_no_difference 'Project.find(1).issues.count' do
1099 post :move, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :new_tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => ''
1100 end
1101 end
1102 issue_after_move = Issue.first(:order => 'id desc', :conditions => {:project_id => 2})
1103 assert_equal issue_before_move.tracker_id, issue_after_move.tracker_id
1104 assert_equal issue_before_move.status_id, issue_after_move.status_id
1105 assert_equal issue_before_move.assigned_to_id, issue_after_move.assigned_to_id
1106 end
1107
1094 1108 should "allow changing the issue's attributes" do
1095 1109 @request.session[:user_id] = 2
1096 1110 assert_difference 'Issue.count', 2 do
1097 1111 assert_no_difference 'Project.find(1).issues.count' do
1098 post :move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'}, :assigned_to_id => 4, :status_id => 3, :start_date => '2009-12-01', :due_date => '2009-12-31'
1112 post :move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'}, :new_tracker_id => '', :assigned_to_id => 4, :status_id => 3, :start_date => '2009-12-01', :due_date => '2009-12-31'
1099 1113 end
1100 1114 end
1101 1115
General Comments 0
You need to be logged in to leave comments. Login now