Bläddra i källkod

Fixed: error while moving an issue to a project with disabled tracker with SQLite3 (#5049).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3566 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/1.0.0
Jean-Philippe Lang 14 år sedan
förälder
incheckning
3dc4dbe302
2 ändrade filer med 14 tillägg och 4 borttagningar
  1. 4
    4
      app/models/issue.rb
  2. 10
    0
      test/unit/issue_test.rb

+ 4
- 4
app/models/issue.rb Visa fil

@@ -101,7 +101,7 @@ class Issue < ActiveRecord::Base
def move_to(new_project, new_tracker = nil, options = {})
options ||= {}
issue = options[:copy] ? self.clone : self
transaction do
ret = Issue.transaction do
if new_project && issue.project_id != new_project.id
# delete issue relations
unless Setting.cross_project_issue_relations?
@@ -138,12 +138,12 @@ class Issue < ActiveRecord::Base
# Manually update project_id on related time entries
TimeEntry.update_all("project_id = #{new_project.id}", {:issue_id => id})
end
true
else
Issue.connection.rollback_db_transaction
return false
raise ActiveRecord::Rollback
end
end
return issue
ret ? issue : false
end
def priority_id=(pid)

+ 10
- 0
test/unit/issue_test.rb Visa fil

@@ -387,6 +387,16 @@ class IssueTest < ActiveSupport::TestCase
assert_equal 7, issue.fixed_version_id
end
def test_move_to_another_project_with_disabled_tracker
issue = Issue.find(1)
target = Project.find(2)
target.tracker_ids = [3]
target.save
assert_equal false, issue.move_to(target)
issue.reload
assert_equal 1, issue.project_id
end
def test_copy_to_the_same_project
issue = Issue.find(1)
copy = nil

Laddar…
Avbryt
Spara