Project

General

Profile

Defect #15320 ยป issue_parent.patch

Christian Ferbar, 2015-08-11 19:53

View differences:

/usr/share/redmine/app/models/issue.rb 2015-08-11 19:41:57.408794526 +0200
615 632
      if !valid_parent_project?(@parent_issue)
616 633
        errors.add :parent_issue_id, :invalid
617 634
      elsif (@parent_issue != parent) && (all_dependent_issues.include?(@parent_issue) || @parent_issue.all_dependent_issues.include?(self))
618
        errors.add :parent_issue_id, :invalid
635
        if all_dependent_issues.include?(@parent_issue)
636
           # this would create a loop, don't like that! - new parent is a child or sub child of me
637
           errors.add :parent_issue_id, "loop prevention #{@parent_issue} is a direct or indirect child of this topic"
638
        end
639
        parent_dependencies = @parent_issue.all_dependent_issues
640
        if parent_dependencies.include?(self) 
641
           # a child of this topic is also a child of the new parent
642
           f=parent_dependencies[0];
643
           errors.add :parent_issue_id, "an issue depending on the new parent also depends on this issue: #{f}"
644
        end
619 645
      elsif !new_record?
620 646
        # moving an existing issue
621 647
        if @parent_issue.root_id != root_id
    (1-1/1)