Index: app/controllers/issues_controller.rb =================================================================== --- app/controllers/issues_controller.rb (revision 16111) +++ app/controllers/issues_controller.rb (working copy) @@ -355,6 +355,9 @@ if reassign_to.nil? flash.now[:error] = l(:error_issue_not_found_in_project) return + elsif @issues.include?(reassign_to) + flash.now[:error] = l(:error_reassigning_time_entries_to_deleting_issue) + return else TimeEntry.where(['issue_id IN (?)', @issues]). update_all("issue_id = #{reassign_to.id}") Index: config/locales/en.yml =================================================================== --- config/locales/en.yml (revision 16111) +++ config/locales/en.yml (working copy) @@ -218,6 +218,7 @@ error_no_tracker_allowed_for_new_issue_in_project: "The project doesn't have any trackers for which you can create an issue" error_no_projects_with_tracker_allowed_for_new_issue: "There are no projects with trackers for which you can create an issue" error_move_of_child_not_possible: "Subtask %{child} could not be moved to the new project: %{errors}" + error_reassigning_time_entries_to_deleting_issue: "Cannot reassign reported hours to the issue about to be deleted." mail_subject_lost_password: "Your %{value} password" mail_body_lost_password: 'To change your password, click on the following link:' Index: test/functional/issues_controller_test.rb =================================================================== --- test/functional/issues_controller_test.rb (revision 16111) +++ test/functional/issues_controller_test.rb (working copy) @@ -4684,6 +4684,14 @@ end end assert_response :success + + assert_no_difference 'Issue.count' do + assert_no_difference 'TimeEntry.count' do + # try to reassign time to the issue about to be deleted + delete :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 3 + end + end + assert_response :success end def test_destroy_issues_from_different_projects