Commit 6761dc44 authored by jplang's avatar jplang

Setting to disable automatic closing of duplicates (#26192).

git-svn-id: https://svn.redmine.org/redmine/trunk@16697 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent f2e5c8eb
......@@ -1798,7 +1798,7 @@ class Issue < ActiveRecord::Base
# Closes duplicates if the issue is being closed
def close_duplicates
if closing?
if Setting.close_duplicate_issues? && closing?
duplicates.each do |duplicate|
# Reload is needed in case the duplicate was updated by a previous duplicate
duplicate.reload
......
......@@ -7,6 +7,8 @@
<p><%= setting_select :cross_project_subtasks, cross_project_subtasks_options %></p>
<p><%= setting_check_box :close_duplicate_issues %></p>
<p><%= setting_check_box :issue_group_assignment %></p>
<p><%= setting_check_box :default_issue_start_date_to_creation_date %></p>
......
......@@ -462,6 +462,7 @@ en:
setting_new_item_menu_tab: Project menu tab for creating new objects
setting_commit_logs_formatting: Apply text formatting to commit messages
setting_timelog_required_fields: Required fields for time logs
setting_close_duplicate_issues: Close duplicate issues automatically
permission_add_project: Create project
permission_add_subprojects: Create subprojects
......
......@@ -474,6 +474,7 @@ fr:
setting_new_item_menu_tab: Onglet de création d'objets dans le menu du project
setting_commit_logs_formatting: Appliquer le formattage de texte aux messages de commit
setting_timelog_required_fields: Champs obligatoire pour les temps passés
setting_close_duplicate_issues: Fermer les doublons automatiquement
permission_add_project: Créer un projet
permission_add_subprojects: Créer des sous-projets
......
......@@ -173,6 +173,8 @@ parent_issue_done_ratio:
default: 'derived'
link_copied_issue:
default: 'ask'
close_duplicate_issues:
default: 1
issue_group_assignment:
default: 0
default_issue_start_date_to_creation_date:
......
......@@ -1436,6 +1436,23 @@ class IssueTest < ActiveSupport::TestCase
assert issue3.reload.closed?
end
def test_should_not_close_duplicate_when_disabled
issue = Issue.generate!
duplicate = Issue.generate!
IssueRelation.create!(:issue_from => duplicate, :issue_to => issue,
:relation_type => IssueRelation::TYPE_DUPLICATES)
assert issue.reload.duplicates.include?(duplicate)
with_settings :close_duplicate_issues => '0' do
issue.init_journal(User.first, "Closing issue")
issue.status = IssueStatus.where(:is_closed => true).first
issue.save
end
assert !duplicate.reload.closed?
end
def test_should_close_duplicates_with_private_notes
issue = Issue.generate!
duplicate = Issue.generate!
......
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