summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-11-29 19:12:53 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-11-29 19:12:53 +0000
commit1b8d448b8292f2cbb86accf31e0dda940fbaaba2 (patch)
treed08a11bcb548ba8d718b74a7b212c37182b21418
parent8e072c48770036b89b1048698c51ae921dec2567 (diff)
downloadredmine-1b8d448b8292f2cbb86accf31e0dda940fbaaba2.tar.gz
redmine-1b8d448b8292f2cbb86accf31e0dda940fbaaba2.zip
Merged r17658 and r17659 to 3.4-stable (#30001).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17664 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/issue_import.rb5
-rw-r--r--test/unit/issue_import_test.rb12
2 files changed, 16 insertions, 1 deletions
diff --git a/app/models/issue_import.rb b/app/models/issue_import.rb
index ad04c0be5..9fc4f5550 100644
--- a/app/models/issue_import.rb
+++ b/app/models/issue_import.rb
@@ -122,7 +122,10 @@ class IssueImport < Import
end
end
if issue.project && version_name = row_value(row, 'fixed_version')
- if version = issue.project.versions.named(version_name).first
+ version =
+ issue.project.versions.named(version_name).first ||
+ issue.project.shared_versions.named(version_name).first
+ if version
attributes['fixed_version_id'] = version.id
elsif create_versions?
version = issue.project.versions.build
diff --git a/test/unit/issue_import_test.rb b/test/unit/issue_import_test.rb
index 9d8723393..3e0eecae6 100644
--- a/test/unit/issue_import_test.rb
+++ b/test/unit/issue_import_test.rb
@@ -188,4 +188,16 @@ class IssueImportTest < ActiveSupport::TestCase
import.run
assert !File.exists?(file_path)
end
+
+ def test_run_should_consider_project_shared_versions
+ system_version = Version.generate!(:project_id => 2, :sharing => 'system', :name => '2.1')
+ system_version.save!
+
+ import = generate_import_with_mapping
+ import.mapping.merge!('fixed_version' => '9')
+ import.save!
+
+ issues = new_records(Issue, 3) { import.run }
+ assert [nil, 3, system_version.id], issues.map(&:fixed_version_id)
+ end
end