From cd71c1cc0ad732af55e9665cfc742c066647536f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 10 Dec 2010 17:37:24 +0000 Subject: [PATCH] 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 --- app/models/project.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index 805e29414..99a4a4984 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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| -- 2.39.5