Commit e5dcebf9 authored by jplang's avatar jplang

Make Status map-able for CSV import (#22951).

git-svn-id: https://svn.redmine.org/redmine/trunk@15493 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent e394efeb
......@@ -92,7 +92,11 @@ class IssueImport < Import
'subject' => row_value(row, 'subject'),
'description' => row_value(row, 'description')
}
attributes
if status_name = row_value(row, 'status')
if status_id = IssueStatus.named(status_name).first.try(:id)
attributes['status_id'] = status_id
end
end
issue.send :safe_attributes=, attributes, user
attributes = {}
......
......@@ -9,6 +9,10 @@
<%= mapping_select_tag @import, 'tracker', :required => true,
:values => @import.allowed_target_trackers.sorted.map {|t| [t.name, t.id]} %>
</p>
<p>
<label><%= l(:field_status) %></label>
<%= mapping_select_tag @import, 'status' %>
</p>
<div class="splitcontent">
<div class="splitcontentleft">
......
priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user;estimated_hours;tracker
High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper;1;bug
Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;;2;feature request
Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;;3;bug
priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user;estimated_hours;tracker;status
High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper;1;bug;new
Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;;2;feature request;new
Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;;3;bug;assigned
......@@ -89,6 +89,15 @@ class IssueImportTest < ActiveSupport::TestCase
assert_include "Tracker cannot be blank", item.message
end
def test_status_should_be_set
import = generate_import_with_mapping
import.mapping.merge!('status' => '14')
import.save!
issues = new_records(Issue, 3) { import.run }
assert_equal ['New', 'New', 'Assigned'], issues.map(&:status).map(&:name)
end
def test_parent_should_be_set
import = generate_import_with_mapping
import.mapping.merge!('parent_issue_id' => '5')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment