##// END OF EJS Templates
Fixed that bulk copy raises an error on validation failure (#13943)....
Jean-Philippe Lang -
r11558:d69de691a79b
parent child
Show More
@@ -260,13 +260,15 class IssuesController < ApplicationController
260 @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}}
260 @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}}
261 end
261 end
262
262
263 @issues.each do |issue|
263 @issues.each do |orig_issue|
264 issue.reload
264 orig_issue.reload
265 if @copy
265 if @copy
266 issue = issue.copy({},
266 issue = orig_issue.copy({},
267 :attachments => params[:copy_attachments].present?,
267 :attachments => params[:copy_attachments].present?,
268 :subtasks => params[:copy_subtasks].present?
268 :subtasks => params[:copy_subtasks].present?
269 )
269 )
270 else
271 issue = orig_issue
270 end
272 end
271 journal = issue.init_journal(User.current, params[:notes])
273 journal = issue.init_journal(User.current, params[:notes])
272 issue.safe_attributes = attributes
274 issue.safe_attributes = attributes
@@ -274,7 +276,7 class IssuesController < ApplicationController
274 if issue.save
276 if issue.save
275 saved_issues << issue
277 saved_issues << issue
276 else
278 else
277 unsaved_issues << issue
279 unsaved_issues << orig_issue
278 end
280 end
279 end
281 end
280
282
@@ -3821,6 +3821,13 class IssuesControllerTest < ActionController::TestCase
3821 assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
3821 assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
3822 end
3822 end
3823
3823
3824 def test_bulk_copy_with_all_failures_should_display_errors
3825 @request.session[:user_id] = 2
3826 post :bulk_update, :ids => [1, 2], :copy => '1', :issue => {:start_date => 'foo'}
3827
3828 assert_response :success
3829 end
3830
3824 def test_destroy_issue_with_no_time_entries
3831 def test_destroy_issue_with_no_time_entries
3825 assert_nil TimeEntry.find_by_issue_id(2)
3832 assert_nil TimeEntry.find_by_issue_id(2)
3826 @request.session[:user_id] = 2
3833 @request.session[:user_id] = 2
General Comments 0
You need to be logged in to leave comments. Login now