auto_select_fields.patch

Haihan Ji, 2016-05-27 15:55

Download (1.14 KB)

View differences:

app/controllers/imports_controller.rb
63 63
    @attributes = issue.safe_attribute_names
64 64
    @custom_fields = issue.editable_custom_field_values.map(&:custom_field)
65 65

  
66
    if @import.mapping.empty?
67
      @import.settings['mapping'] = {}
68
      # Core issue fields
69
      %w(subject description priority category assigned_to fixed_version is_private parent_issue_id start_date due_date estimated_hours done_ratio).each do |field|
70
        label = l("field_#{field.gsub(/\_id$/, '')}".to_sym)
71
        @import.mapping[field] = @import.headers.index(label)
72
      end
73
      # Custom fields
74
      issue.available_custom_fields.each do |field|
75
        @import.mapping["cf_#{field.id}"] = @import.headers.index(field.name)
76
      end
77
    end
78

  
66 79
    if request.post?
67 80
      respond_to do |format|
68 81
        format.html {
......
121 134
  def max_items_per_request
122 135
    5
123 136
  end
137

  
124 138
end