@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)
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
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: الرجاء التحديد
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:
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: Изберете
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
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"
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
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:
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
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: Παρακαλώ επιλέξτε
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
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
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.
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.
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"
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
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: گزینش کنید
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ä
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
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
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: בחר בבקשה
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
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: Kérem válasszon
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: Silakan pilih
cant_link_an_issue_with_a_descendant: "Una segnalazione non può essere collegata a una delle sue discendenti"
earlier_than_minimum_start_date: "non può essere precedente a %{date} a causa di una precedente segnalazione"
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: Scegli
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: 選んでください
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: 선택하세요
cant_link_an_issue_with_a_descendant: "Darbas negali būti susietas su viena iš savo darbo dalių"
earlier_than_minimum_start_date: "negali būti anksčiau už %{date} dėl ankstesnių darbų"
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: Prašom parinkti
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: Izvēlieties
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: Изберете
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: Сонгоно уу
cant_link_an_issue_with_a_descendant: "Een issue kan niet gelinked worden met een subtask"
earlier_than_minimum_start_date: "kan niet eerder zijn dan %{date} wegens voorafgaande 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: Selecteren
cant_link_an_issue_with_a_descendant: "En sak kan ikke kobles mot en av sine undersaker"
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: Vennligst velg
cant_link_an_issue_with_a_descendant: "Zagadnienie nie może zostać powiązane z jednym z własnych podzagadnień"
earlier_than_minimum_start_date: "nie może być wcześniej niż %{date} z powodu poprzedających zagadnień"
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:
cant_link_an_issue_with_a_descendant: "Uma tarefa não pode ser relaciona a uma de suas subtarefas"
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: Selecione
cant_link_an_issue_with_a_descendant: "Não é possível ligar uma tarefa a uma sub-tarefa que lhe é pertencente"
earlier_than_minimum_start_date: "não pode ser antes de %{date} devido a tarefas precedentes"
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: Selecione
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: Selectați
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"
support:
array:
cant_link_an_issue_with_a_descendant: "Nemožno prepojiť úlohu s niektorou z podúloh"
earlier_than_minimum_start_date: "nemôže byť skorší ako %{date} z dôvodu nadväznosti na predchádzajúce úlohy"
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: Vyberte
cant_link_an_issue_with_a_descendant: "Zahtevek ne more biti povezan s svojo podnalogo"
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: Prosimo izberite
cant_link_an_issue_with_a_descendant: "Nje ceshtje nuk mund te lidhet me nenceshtje"
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: Zgjidhni
cant_link_an_issue_with_a_descendant: "Problem ne može biti povezan sa jednim od svojih podzadataka"
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: Molim odaberite
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: Молим одаберите
cant_link_an_issue_with_a_descendant: "Ett ärende kan inte länkas till ett av dess underärenden"
earlier_than_minimum_start_date: "kan inte vara tidigare än% {datum} på grund av föregående ärenden"
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"
direction: ltr
date:
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: กรุณาเลือก
cant_link_an_issue_with_a_descendant: "Bir iş, alt işlerinden birine bağlanamaz"
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"
models:
actionview_instancetag_blank_option: Lütfen Seçin
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: Оберіть
cant_link_an_issue_with_a_descendant: "Một vấn đề không thể liên kết tới một trong số những tác vụ con của nó"
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"
direction: ltr
date:
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"
# You can define own errors for models or model attributes.
# The values :model, :attribute and :value are always available for interpolation.
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: 请选择
parent.generate_child!(:estimated_hours => 7)
assert_equal 12, parent.reload.total_estimated_hours
end
+
+ def test_open_issue_with_closed_parent_should_not_validate
+ parent = Issue.generate!(:status_id => 5)
+ child = Issue.generate!
+
+ child.parent_issue_id = parent.id
+ assert !child.save
+ assert_include I18n.t("activerecord.errors.messages.open_issue_with_closed_parent"), child.errors.full_messages
+ end
end
assert !closed_statuses.empty?
end
+ def test_parent_issues_with_open_subtask_dont_allow_closed_statuses
+ parent = Issue.generate!
+ child = Issue.generate!(:parent_issue_id => parent.id)
+
+ allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002))
+ assert allowed_statuses.any?
+ assert_equal [], allowed_statuses.select(&:is_closed?)
+ end
+
+ def test_parent_issues_with_closed_subtask_allow_closed_statuses
+ parent = Issue.generate!
+ child = Issue.generate!(:parent_issue_id => parent.id, :status_id => 5)
+
+ allowed_statuses = parent.reload.new_statuses_allowed_to(users(:users_002))
+ assert allowed_statuses.any?
+ assert allowed_statuses.select(&:is_closed?).any?
+ end
+
def test_reschedule_an_issue_without_dates
with_settings :non_working_week_days => [] do
issue = Issue.new(:start_date => nil, :due_date => nil)