Do not try to copy relations for issues that could not be copied.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4484 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2010-12-10 17:37:24 +00:00
parent ab6a93b029
commit cd71c1cc0a
1 changed files with 9 additions and 1 deletions

View File

@ -688,12 +688,20 @@ class Project < ActiveRecord::Base
end
self.issues << new_issue
issues_map[issue.id] = new_issue
if new_issue.new_record?
logger.info "Project#copy_issues: issue ##{issue.id} could not be copied: #{new_issue.errors.full_messages}" if logger && logger.info
else
issues_map[issue.id] = new_issue unless new_issue.new_record?
end
end
# Relations after in case issues related each other
project.issues.each do |issue|
new_issue = issues_map[issue.id]
unless new_issue
# Issue was not copied
next
end
# Relations
issue.relations_from.each do |source_relation|