]> source.dussan.org Git - redmine.git/commitdiff
Do not try to copy relations for issues that could not be copied.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 10 Dec 2010 17:37:24 +0000 (17:37 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 10 Dec 2010 17:37:24 +0000 (17:37 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4484 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb

index 805e29414145e76df2e9cc0cb2aa037d00f5d583..99a4a4984b8f30159389a893e84529c9646849bf 100644 (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|