Project

General

Profile

Defect #7023 » issue.rb.1.1.0.copy_children.patch

Revised working patch for issue.rb from 1.1.0 - r4732 - Daniel Reiche, 2011-01-20 09:45

View differences:

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
issue
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
def status_id=(sid)
self.status = nil
write_attribute(:status_id, sid)
......
and i.project_id=#{project.id}
group by s.id, s.is_closed, j.id")
end
end
(3-3/3)