Defect #15320

Changing Child's Parent Ticket Field To Parent's Parent fails.

Added by William Roush about 4 years ago. Updated almost 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:-
Resolution:Duplicate Affected version:

Description

Example:

  • 1000
    • 1001
      • 1002

Changing 1002's parent from 1001 -> 1000 results in an error.

issue_parent.patch Magnifier (1.16 KB) Christian Ferbar, 2015-08-11 19:53


Related issues

Related to Redmine - Defect #15811: Changing Ticket's Project In Parent/Child Relationship Fails New
Duplicates Redmine - Defect #13654: Can't set parent issue when issue relations among child i... Closed

History

#1 Updated by William Roush about 4 years ago

It's a generic "this is an invalid parent ID" changing it to "" then "1000" works fine though.

#2 Updated by Toru Haraguchi about 4 years ago

+1
We have same issue.
Working around by once detaching the child as an independent one.

#3 Updated by Toshi MARUYAMA about 4 years ago

  • Category set to Issues

#4 Updated by Toshi MARUYAMA almost 4 years ago

  • Related to Defect #15811: Changing Ticket's Project In Parent/Child Relationship Fails added

#5 Updated by @ go2null over 3 years ago

Using Redmine v2.5.1.

In app/models/issue.rb, there is the following bit of code.

      elsif (@parent_issue != parent) && (all_dependent_issues.include?(@parent_issue) || @parent_issue.all_dependent_issues.include?(self))¬
        #go2null:errors.add :parent_issue_id, :invalid¬
        errors.add :parent_issue_id, " - bad depends"¬
      elsif !new_record?¬
        # moving an existing issue¬
        if @parent_issue.root_id != root_id¬
          # we can always move to another tree¬
        elsif move_possible?(@parent_issue# move accepted inside tree¬
        else¬
          errors.add :parent_issue_id, :invalid¬
        end¬
      end¬

It appears that the move accepted inside tree will never be invoked because (all_dependent_issues.include?(@parent_issue) || parent_issue.all_dependent_issues.include?(self)) will always be true.

In fact, both all_dependent_issues.include?(@parent_issue) and parent_issue.all_dependent_issues.include?(self) will always be true when moving a grandchild to a grandparent, or vice versa.

Or am I reading this wrong?

#6 Updated by @ go2null over 3 years ago

The elsif was added in r11641 to fix #8794 Circular loop when using relations and subtasks.

Based on this, it seems that #13654 (Can't set parent issue when issue relations among child issues are present) may also be related.

#7 Updated by @ go2null over 3 years ago

It seems that the previous code (r3573), before r11641, which implemented subtasking (#443), allowed moving grandchild (descendents) around the tree. (# move accepted inside tree).

#8 Updated by Toshi MARUYAMA over 3 years ago

  • Related to Defect #13654: Can't set parent issue when issue relations among child issues are present added

#9 Updated by Christian Ferbar over 2 years ago

This patch prints the reason why the parent issue is bad. For example if you have the issues

new_parent
issue, parent: new_parent
editing_issue, subtasks: issue

if you set the parent of editing_issue to new_parent it will print that issue is already a child of new_parent . On the other hand it will print that a loop would be generated if so.

could you add my patch pls ... or something more advanced with translation...

Anybody knows why there is a check for @parent_issue.all_dependent_issues.include?(self)? This won't produce a loop.

#10 Updated by Go MAEDA almost 2 years ago

  • Resolution set to Duplicate

Fixed by #13654. We can complete the described operation since r15056.

#11 Updated by Go MAEDA almost 2 years ago

  • Status changed from New to Closed

#12 Updated by Go MAEDA almost 2 years ago

  • Related to deleted (Defect #13654: Can't set parent issue when issue relations among child issues are present)

#13 Updated by Go MAEDA almost 2 years ago

  • Duplicates Defect #13654: Can't set parent issue when issue relations among child issues are present added

Also available in: Atom PDF