summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-04-23 03:57:19 +0000
committerGo MAEDA <maeda@farend.jp>2021-04-23 03:57:19 +0000
commit3605e313abe1f3fee2b25c85acd4b240013e1e86 (patch)
tree886f620b1b33af2d4ecc672ca196a8a6ade90842
parentf71e316e501db1969873a18ebf22c1013fc8162d (diff)
downloadredmine-3605e313abe1f3fee2b25c85acd4b240013e1e86.tar.gz
redmine-3605e313abe1f3fee2b25c85acd4b240013e1e86.zip
Merged r20968 from trunk to 4.2-stable (#35131).
git-svn-id: http://svn.redmine.org/redmine/branches/4.2-stable@20969 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/issue_import.rb12
-rw-r--r--test/fixtures/files/import_issues_auto_mapping.csv4
-rw-r--r--test/functional/imports_controller_test.rb12
3 files changed, 25 insertions, 3 deletions
diff --git a/app/models/issue_import.rb b/app/models/issue_import.rb
index 309640ae6..9f6edf903 100644
--- a/app/models/issue_import.rb
+++ b/app/models/issue_import.rb
@@ -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
diff --git a/test/fixtures/files/import_issues_auto_mapping.csv b/test/fixtures/files/import_issues_auto_mapping.csv
index ba45a0ae7..d08f99fa2 100644
--- a/test/fixtures/files/import_issues_auto_mapping.csv
+++ b/test/fixtures/files/import_issues_auto_mapping.csv
@@ -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"
diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb
index 7097d8185..fa1229791 100644
--- a/test/functional/imports_controller_test.rb
+++ b/test/functional/imports_controller_test.rb
@@ -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