]> source.dussan.org Git - redmine.git/commitdiff
Allow Unique ID and relation fields to be auto mapped (#35131).
authorGo MAEDA <maeda@farend.jp>
Fri, 23 Apr 2021 03:53:53 +0000 (03:53 +0000)
committerGo MAEDA <maeda@farend.jp>
Fri, 23 Apr 2021 03:53:53 +0000 (03:53 +0000)
Patch by Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@20968 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue_import.rb
test/fixtures/files/import_issues_auto_mapping.csv
test/functional/imports_controller_test.rb

index 309640ae6df5b4052a99bff7d868e4213c4f9e1a..9f6edf903938c7a152b94d682502a0dbc0b7f997 100644 (file)
@@ -32,7 +32,17 @@ class IssueImport < Import
     'start_date' => 'field_start_date',
     'due_date' => 'field_due_date',
     'estimated_hours' => 'field_estimated_hours',
-    'done_ratio' => 'field_done_ratio'
+    'done_ratio' => 'field_done_ratio',
+    'unique_id' => 'field_unique_id',
+    'relation_duplicates' => 'label_duplicates',
+    'relation_duplicated' => 'label_duplicated_by',
+    'relation_blocks' => 'label_blocks',
+    'relation_blocked' => 'label_blocked_by',
+    'relation_relates' => 'label_relates_to',
+    'relation_precedes' => 'label_precedes',
+    'relation_follows' =>  'label_follows',
+    'relation_copied_to' => 'label_copied_to',
+    'relation_copied_from' => 'label_copied_from'
   }
 
   def self.menu_item
index ba45a0ae7823749ec18ddd0d398f7f0e6a10512e..d08f99fa21012d9c5e407ad6257df1af35e3f561 100644 (file)
@@ -1,2 +1,2 @@
-priority;Subject;start_date;parent;private;progress;custom;"target version";category;user;estimated_hours;tracker;status;database;cf_6;
-High;First;2015-07-08;;no;;PostgreSQL;;New category;dlopper;1;bug;new;"PostgreSQL, Oracle";2;"Column with empty header"
+priority;Subject;start_date;parent;private;progress;custom;"target version";category;user;estimated_hours;tracker;status;database;cf_6;unique_id;"Is duplicate of"
+High;First;2015-07-08;;no;;PostgreSQL;;New category;dlopper;1;bug;new;"PostgreSQL, Oracle";2;1;4;"Column with empty header"
index 7097d8185085815304c5da0a248b35a3b6e45a2b..fa122979143c77c9a798f0653ee6eb2edae36dc5 100644 (file)
@@ -244,6 +244,18 @@ class ImportsControllerTest < Redmine::ControllerTest
     assert_select 'select[name=?]', 'import_settings[mapping][cf_1]' do
       assert_select 'option[value="13"][selected="selected"]', :text => 'database'
     end
+
+    # 'unique_id' should be auto selected because
+    # - 'unique_id' exists in the import file
+    assert_select 'select[name=?]', 'import_settings[mapping][unique_id]' do
+      assert_select 'option[value="15"][selected="selected"]', :text => 'unique_id'
+    end
+
+    # 'relation_duplicates' should be auto selected because
+    # - 'Is duplicate of' exists in the import file
+    assert_select 'select[name=?]', 'import_settings[mapping][relation_duplicates]' do
+      assert_select 'option[value="16"][selected="selected"]', :text => 'Is duplicate of'
+    end
   end
 
   def test_post_mapping_should_update_mapping