Commit a16bd873 authored by jplang's avatar jplang

Show an error message when changing an issue's project fails due to errors in...

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

git-svn-id: https://svn.redmine.org/redmine/trunk@16089 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 6e43294d
......@@ -1471,6 +1471,7 @@ class Issue < ActiveRecord::Base
# Change project and keep project
child.send :project=, project, true
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
end
end
......
......@@ -270,6 +270,7 @@ de:
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_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_active: Aktiv
......
......@@ -216,6 +216,7 @@ en:
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_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_body_lost_password: 'To change your password, click on the following link:'
......
......@@ -236,6 +236,7 @@ fr:
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_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_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :'
......
......@@ -1709,6 +1709,18 @@ class IssueTest < ActiveSupport::TestCase
assert_equal 3, issue.tracker_id
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
issue = Issue.find(1)
copy = issue.copy
......
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