1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

Show an error message when changing an issue's project fails due to errors in child issues (#23888).

git-svn-id: http://svn.redmine.org/redmine/trunk@16089 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2016-12-18 08:54:26 +00:00
parent 757f378ab1
commit 3b7da88a83
5 changed files with 16 additions and 0 deletions

View File

@ -1471,6 +1471,7 @@ class Issue < ActiveRecord::Base
# Change project and keep project # Change project and keep project
child.send :project=, project, true child.send :project=, project, true
unless child.save unless child.save
errors.add :base, l(:error_move_of_child_not_possible, :child => "##{child.id}", :errors => child.errors.full_messages.join(", "))
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
end end

View File

@ -270,6 +270,7 @@ de:
error_unable_to_connect: Fehler beim Verbinden (%{value}) error_unable_to_connect: Fehler beim Verbinden (%{value})
error_workflow_copy_source: Bitte wählen Sie einen Quell-Tracker und eine Quell-Rolle. error_workflow_copy_source: Bitte wählen Sie einen Quell-Tracker und eine Quell-Rolle.
error_workflow_copy_target: Bitte wählen Sie die Ziel-Tracker und -Rollen. error_workflow_copy_target: Bitte wählen Sie die Ziel-Tracker und -Rollen.
error_move_of_child_not_possible: "Unteraufgabe %{child} nicht in das neue Projekt verschoben werden konnten: %{errors}"
field_account: Konto field_account: Konto
field_active: Aktiv field_active: Aktiv

View File

@ -216,6 +216,7 @@ en:
error_ldap_bind_credentials: "Invalid LDAP Account/Password" error_ldap_bind_credentials: "Invalid LDAP Account/Password"
error_no_tracker_allowed_for_new_issue_in_project: "The project doesn't have any trackers for which you can create an issue" error_no_tracker_allowed_for_new_issue_in_project: "The project doesn't have any trackers for which you can create an issue"
error_no_projects_with_tracker_allowed_for_new_issue: "There are no projects with trackers for which you can create an issue" error_no_projects_with_tracker_allowed_for_new_issue: "There are no projects with trackers for which you can create an issue"
error_move_of_child_not_possible: "Subtask %{child} could not be moved to the new project: %{errors}"
mail_subject_lost_password: "Your %{value} password" mail_subject_lost_password: "Your %{value} password"
mail_body_lost_password: 'To change your password, click on the following link:' mail_body_lost_password: 'To change your password, click on the following link:'

View File

@ -236,6 +236,7 @@ fr:
error_ldap_bind_credentials: "Identifiant ou mot de passe LDAP incorrect" error_ldap_bind_credentials: "Identifiant ou mot de passe LDAP incorrect"
error_no_tracker_allowed_for_new_issue_in_project: "Le projet ne dispose d'aucun tracker sur lequel vous pouvez créer une demande" error_no_tracker_allowed_for_new_issue_in_project: "Le projet ne dispose d'aucun tracker sur lequel vous pouvez créer une demande"
error_no_projects_with_tracker_allowed_for_new_issue: "Aucun projet ne dispose d'un tracker sur lequel vous pouvez créer une demande" error_no_projects_with_tracker_allowed_for_new_issue: "Aucun projet ne dispose d'un tracker sur lequel vous pouvez créer une demande"
error_move_of_child_not_possible: "La sous-tâche %{child} n'a pas pu être déplacée dans le nouveau projet : %{errors}"
mail_subject_lost_password: "Votre mot de passe %{value}" mail_subject_lost_password: "Votre mot de passe %{value}"
mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :' mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :'

View File

@ -1709,6 +1709,18 @@ class IssueTest < ActiveSupport::TestCase
assert_equal 3, issue.tracker_id assert_equal 3, issue.tracker_id
end end
def test_move_to_another_project_should_set_error_message_on_child_failure
parent = Issue.generate!
child = Issue.generate!(:parent_issue_id => parent.id, :tracker_id => 2)
project = Project.generate!(:tracker_ids => [1])
parent.reload
parent.project_id = project.id
assert !parent.save
assert_include "Subtask ##{child.id} could not be moved to the new project: Tracker is not included in the list",
parent.errors[:base]
end
def test_copy_to_the_same_project def test_copy_to_the_same_project
issue = Issue.find(1) issue = Issue.find(1)
copy = issue.copy copy = issue.copy