##// END OF EJS Templates
Make Status map-able for CSV import (#22951)....
Jean-Philippe Lang -
r15111:f6754a0f7a37
parent child
Show More
@@ -92,7 +92,11 class IssueImport < Import
92 'subject' => row_value(row, 'subject'),
92 'subject' => row_value(row, 'subject'),
93 'description' => row_value(row, 'description')
93 'description' => row_value(row, 'description')
94 }
94 }
95 attributes
95 if status_name = row_value(row, 'status')
96 if status_id = IssueStatus.named(status_name).first.try(:id)
97 attributes['status_id'] = status_id
98 end
99 end
96 issue.send :safe_attributes=, attributes, user
100 issue.send :safe_attributes=, attributes, user
97
101
98 attributes = {}
102 attributes = {}
@@ -9,6 +9,10
9 <%= mapping_select_tag @import, 'tracker', :required => true,
9 <%= mapping_select_tag @import, 'tracker', :required => true,
10 :values => @import.allowed_target_trackers.sorted.map {|t| [t.name, t.id]} %>
10 :values => @import.allowed_target_trackers.sorted.map {|t| [t.name, t.id]} %>
11 </p>
11 </p>
12 <p>
13 <label><%= l(:field_status) %></label>
14 <%= mapping_select_tag @import, 'status' %>
15 </p>
12
16
13 <div class="splitcontent">
17 <div class="splitcontent">
14 <div class="splitcontentleft">
18 <div class="splitcontentleft">
@@ -1,4 +1,4
1 priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user;estimated_hours;tracker
1 priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user;estimated_hours;tracker;status
2 High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper;1;bug
2 High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper;1;bug;new
3 Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;;2;feature request
3 Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;;2;feature request;new
4 Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;;3;bug
4 Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;;3;bug;assigned
@@ -89,6 +89,15 class IssueImportTest < ActiveSupport::TestCase
89 assert_include "Tracker cannot be blank", item.message
89 assert_include "Tracker cannot be blank", item.message
90 end
90 end
91
91
92 def test_status_should_be_set
93 import = generate_import_with_mapping
94 import.mapping.merge!('status' => '14')
95 import.save!
96
97 issues = new_records(Issue, 3) { import.run }
98 assert_equal ['New', 'New', 'Assigned'], issues.map(&:status).map(&:name)
99 end
100
92 def test_parent_should_be_set
101 def test_parent_should_be_set
93 import = generate_import_with_mapping
102 import = generate_import_with_mapping
94 import.mapping.merge!('parent_issue_id' => '5')
103 import.mapping.merge!('parent_issue_id' => '5')
General Comments 0
You need to be logged in to leave comments. Login now