]> source.dussan.org Git - redmine.git/commitdiff
Merged r17658 and r17659 to 3.4-stable (#30001).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 29 Nov 2018 19:12:53 +0000 (19:12 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 29 Nov 2018 19:12:53 +0000 (19:12 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17664 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue_import.rb
test/unit/issue_import_test.rb

index ad04c0be5fc1a19a50cac3deb747875e921908cc..9fc4f55502646b7bcfb98d73e636efd124edd931 100644 (file)
@@ -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
index 9d87233935bd94ad6d03c8a150bc1004ed04c824..3e0eecae620bfe708f5cd154d09b47dcef4336cc 100644 (file)
@@ -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