Project

General

Profile

Actions

Defect #17068

open

When copying subtasks with relations between them self's are lost

Added by Fernando Hartmann over 12 years ago. Updated 6 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Resolution:
Affected version:

Description

Suppose I have a task (Task1) with two subtaks, Sub1 and Sub2 and Sub1 preceeds sub2.
If I copy Task1 with subtask, the relation between the subtask aren't copied to the new ones.


Files


Related issues

Related to Redmine - Defect #15742: No warning when copying subtasks to another project with different trackersNewActions
Actions #1

Updated by Toshi MARUYAMA over 12 years ago

  • Related to Defect #15742: No warning when copying subtasks to another project with different trackers added
Actions #2

Updated by Robert Beckett over 8 years ago

I Created a patch against 3.4 stable to implement copying subtask interrelations.
It applies cleanly to master.
I have been unable to test on master yet due to issues with updating rails (dependency problems for actionpack-xml_parser. Ill do this if I ever get time allotted to continue upstream effort, but as I am doing this as part of my (very busy) day job, I doubt that will happen any time soon, so if anyone wants to take this patch and test it on master, I would be grateful.

This patch is currently working fine on our live 3.4 server.

Actions #3

Updated by Markus Boremski about 4 years ago

+1

Actions #4

Updated by Markus Boremski about 2 years ago

This unfortunately still applies to the latest redmine-release.

So I made this patch Work for redmine 5.1.3

Can we please fix this defect in main?
Should be an easy fix thanks to the base of Robert Beckett.

Actions #5

Updated by Jairo Llopis over 1 year ago

This is a very important issue for us. Is there anything we can do to help implementing it? Thanks!

Actions #6

Updated by Markus Boremski 6 days ago

This unfortunately still applies to the latest Redmine releases.

I have verified the behaviour against 6.1-stable (6.1.4) and current master (7.0.1 as of 2026-09-29): when copying an issue together with its subtasks, the subtasks are copied, but the relations between them (precedes/follows, blocks/blocked, relates to, ...) are silently dropped. Issue#after_create_from_copy only recreates the subtask tree, not the relations among the copied children.

Attached is a patch (issue_copy_subtask_relations-6.1-stable.patch, apply with patch -p1 from the Redmine root) that fixes this:

  • after_create_from_copy now keeps a mapping from each original child issue to its copy (instead of only the ids)
  • after all subtasks have been created, a second pass walks the descendants again and recreates every relation whose both ends are part of the copied subtree,
    using the same relation_type relations pointing to issues outside the copied subtree are intentionally left untouched, so no new links to unrelated issues are created
  • if a relation cannot be saved (validation error), it is logged and skipped, the copy itself is not aborted

The original idea dates back to a patch we have been carrying against 5.1.3.
This one has been regenerated against 6.1-stable.
It would be great if this could be considered for inclusion in the core, as the current behaviour makes copying template issues with dependent subtasks quite error-prone.

Actions

Also available in: Atom PDF