Defect #7023 » issue.rb.1.1.0.copy_children.patch
| app/models/issue.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
end
|
||
|
#Copy Function Changes to support copying subtasks with parent tasks. (Call the copy_children Function)
|
||
|
if options[:copy]
|
||
|
copy_children(self, issue.id, new_project)
|
||
|
end
|
||
|
#End Changes
|
||
|
else
|
||
|
return false
|
||
|
end
|
||
| ... | ... | |
|
group by s.id, s.is_closed, j.id")
|
||
|
end
|
||
|
|
||
|
#Copy_Children Function to support copying subtasks with parent tasks.
|
||
|
def copy_children(issue, parent_issue_id, new_project)
|
||
|
issue.children.each do |childissue|
|
||
|
child_issue = Issue.new
|
||
|
child_issue.copy_from(childissue)
|
||
|
child_issue.parent_issue_id = parent_issue_id
|
||
|
child_issue.project = new_project
|
||
|
if child_issue.save
|
||
|
unless childissue.copy_children(childissue, child_issue.id,new_project)
|
||
|
# Move failed and transaction was rollback'd
|
||
|
return false
|
||
|
end
|
||
|
else
|
||
|
logger.error "failed to save child issue"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
#End New Copy Function
|
||
|
end
|
||