Do not link copied issues when copying a project (#6899).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10495 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-09-27 22:27:37 +00:00
parent f58ed6c206
commit f1fdbf8d80
2 changed files with 2 additions and 2 deletions

View File

@ -1017,7 +1017,7 @@ class Issue < ActiveRecord::Base
def after_create_from_copy def after_create_from_copy
return unless copy? && !@after_create_from_copy_handled return unless copy? && !@after_create_from_copy_handled
if @copied_from.project_id == project_id || Setting.cross_project_issue_relations? if (@copied_from.project_id == project_id || Setting.cross_project_issue_relations?) && @copy_options[:link] != false
relation = IssueRelation.new(:issue_from => @copied_from, :issue_to => self, :relation_type => IssueRelation::TYPE_COPIED_TO) relation = IssueRelation.new(:issue_from => @copied_from, :issue_to => self, :relation_type => IssueRelation::TYPE_COPIED_TO)
unless relation.save unless relation.save
logger.error "Could not create relation while copying ##{@copied_from.id} to ##{id} due to validation errors: #{relation.errors.full_messages.join(', ')}" if logger logger.error "Could not create relation while copying ##{@copied_from.id} to ##{id} due to validation errors: #{relation.errors.full_messages.join(', ')}" if logger

View File

@ -778,7 +778,7 @@ class Project < ActiveRecord::Base
# get copied before their children # get copied before their children
project.issues.find(:all, :order => 'root_id, lft').each do |issue| project.issues.find(:all, :order => 'root_id, lft').each do |issue|
new_issue = Issue.new new_issue = Issue.new
new_issue.copy_from(issue, :subtasks => false) new_issue.copy_from(issue, :subtasks => false, :link => false)
new_issue.project = self new_issue.project = self
# Reassign fixed_versions by name, since names are unique per project # Reassign fixed_versions by name, since names are unique per project
if issue.fixed_version && issue.fixed_version.project == project if issue.fixed_version && issue.fixed_version.project == project