Commit 558db3ae authored by jplang's avatar jplang
Browse files

Prevent parent issue from being closed if a child issue is open (#10989).

git-svn-id: https://svn.redmine.org/redmine/trunk@16108 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 0b52bb2e
......@@ -723,6 +723,9 @@ class Issue < ActiveRecord::Base
@parent_issue.self_and_ancestors.any? {|a| a.relations_from.any? {|r| r.relation_type == IssueRelation::TYPE_PRECEDES && r.issue_to.would_reschedule?(self)}}
)
errors.add :parent_issue_id, :invalid
elsif !closed? && @parent_issue.closed?
# cannot attach an open issue to a closed parent
errors.add :base, :open_issue_with_closed_parent
elsif !new_record?
# moving an existing issue
if move_possible?(@parent_issue)
......@@ -945,9 +948,14 @@ class Issue < ActiveRecord::Base
end
statuses = statuses.compact.uniq.sort
if blocked?
if blocked? || descendants.open.any?
# cannot close a blocked issue or a parent with open subtasks
statuses.reject!(&:is_closed?)
end
if ancestors.open(false).any?
# cannot reopen a subtask of a closed parent
statuses.select!(&:is_closed?)
end
statuses
end
......
......@@ -130,6 +130,7 @@ ar:
cant_link_an_issue_with_a_descendant: "لا يمكن ان تكون المشكلة مرتبطة بواحدة من المهام الفرعية"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: الرجاء التحديد
......
......@@ -198,6 +198,7 @@ az:
cant_link_an_issue_with_a_descendant: "Tapşırıq özünün alt tapşırığı ilə əlaqəli ola bilməz"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
support:
array:
......
......@@ -132,6 +132,7 @@ bg:
cant_link_an_issue_with_a_descendant: "Една задача не може да бъде свързвана към своя подзадача"
earlier_than_minimum_start_date: "не може да бъде по-рано от %{date} поради предхождащи задачи"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Изберете
......
......@@ -142,6 +142,7 @@ bs:
cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Molimo odaberite
......
......@@ -135,6 +135,7 @@ ca:
cant_link_an_issue_with_a_descendant: "Un assumpte no es pot enllaçar a una de les seves subtasques"
earlier_than_minimum_start_date: "no pot ser anterior a %{date} derivat a les peticions precedents"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: "Seleccionar"
......
......@@ -136,6 +136,7 @@ cs:
cant_link_an_issue_with_a_descendant: "Úkol nemůže být spojen s jedním z jeho dílčích úkolů"
earlier_than_minimum_start_date: "nemůže být dříve než %{date} kvůli předřazeným úkolům"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Prosím vyberte
......
......@@ -143,6 +143,7 @@ da:
cant_link_an_issue_with_a_descendant: "En sag kan ikke relateres til en af dens underopgaver"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
template:
header:
......
......@@ -147,6 +147,7 @@ de:
cant_link_an_issue_with_a_descendant: "Ein Ticket kann nicht mit einer Ihrer Unteraufgaben verlinkt werden"
earlier_than_minimum_start_date: "kann wegen eines Vorgängertickets nicht vor %{date} liegen"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Bitte auswählen
......
......@@ -132,6 +132,7 @@ el:
cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Παρακαλώ επιλέξτε
......
......@@ -135,6 +135,7 @@ en-GB:
cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Please select
......
......@@ -131,6 +131,7 @@ en:
cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Please select
......
......@@ -141,6 +141,7 @@ es-PA:
cant_link_an_issue_with_a_descendant: "Esta incidencia no puede ser ligada a una de estas tareas"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
# Append your own errors here or at the model/attributes scope.
......
......@@ -139,6 +139,7 @@ es:
cant_link_an_issue_with_a_descendant: "Esta petición no puede ser ligada a una de estas tareas"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
# Append your own errors here or at the model/attributes scope.
......
......@@ -148,6 +148,7 @@ et:
cant_link_an_issue_with_a_descendant: "Teemat ei saa sidustada tema enda alamteemaga"
earlier_than_minimum_start_date: "Tähtpäev ei saa olla varasem kui %{date} eelnevate teemade tähtpäevade tõttu"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: "Palun vali"
......
......@@ -133,6 +133,7 @@ eu:
cant_link_an_issue_with_a_descendant: "Zeregin bat ezin da bere azpiataza batekin estekatu."
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Hautatu mesedez
......
......@@ -131,6 +131,7 @@ fa:
cant_link_an_issue_with_a_descendant: "یک مورد نمی‌تواند به یکی از زیر کارهایش پیوند بخورد"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: گزینش کنید
......
......@@ -156,6 +156,7 @@ fi:
cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks"
earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Valitse, ole hyvä
......
......@@ -151,6 +151,7 @@ fr:
cant_link_an_issue_with_a_descendant: "Une demande ne peut pas être liée à l'une de ses sous-tâches"
earlier_than_minimum_start_date: "ne peut pas être antérieure au %{date} à cause des demandes qui précèdent"
not_a_regexp: "n'est pas une expression regulière valide"
open_issue_with_closed_parent: "Une demande ouverte ne peut pas être rattachée à une demande fermée"
actionview_instancetag_blank_option: Choisir
......
......@@ -160,6 +160,7 @@ gl:
cant_link_an_issue_with_a_descendant: "As peticións non poden estar ligadas coas súas subtarefas"
earlier_than_minimum_start_date: "Non pode ser antes de %{date} por mor de peticións anteriores"
not_a_regexp: "is not a valid regular expression"
open_issue_with_closed_parent: "An open issue cannot be attached to a closed parent task"
actionview_instancetag_blank_option: Por favor seleccione
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment