summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/issue_import.rb3
-rw-r--r--app/views/imports/_fields_mapping.html.erb4
-rw-r--r--test/fixtures/files/import_issues.csv8
3 files changed, 11 insertions, 4 deletions
diff --git a/app/models/issue_import.rb b/app/models/issue_import.rb
index 5a8748cd0..30b373add 100644
--- a/app/models/issue_import.rb
+++ b/app/models/issue_import.rb
@@ -128,6 +128,9 @@ class IssueImport < Import
if due_date = row_date(row, 'due_date')
attributes['due_date'] = due_date
end
+ if estimated_hours = row_value(row, 'estimated_hours')
+ attributes['estimated_hours'] = estimated_hours
+ end
if done_ratio = row_value(row, 'done_ratio')
attributes['done_ratio'] = done_ratio
end
diff --git a/app/views/imports/_fields_mapping.html.erb b/app/views/imports/_fields_mapping.html.erb
index 97dac0e66..bb6467eca 100644
--- a/app/views/imports/_fields_mapping.html.erb
+++ b/app/views/imports/_fields_mapping.html.erb
@@ -74,6 +74,10 @@
<%= mapping_select_tag @import, 'due_date' %>
</p>
<p>
+ <label><%= l(:field_estimated_hours) %></label>
+ <%= mapping_select_tag @import, 'estimated_hours' %>
+</p>
+<p>
<label><%= l(:field_done_ratio) %></label>
<%= mapping_select_tag @import, 'done_ratio' %>
</p>
diff --git a/test/fixtures/files/import_issues.csv b/test/fixtures/files/import_issues.csv
index b648a42ba..918f9fc7e 100644
--- a/test/fixtures/files/import_issues.csv
+++ b/test/fixtures/files/import_issues.csv
@@ -1,4 +1,4 @@
-priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user
-High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper
-Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;
-Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;
+priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user;estimated_hours
+High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper;1
+Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;;2
+Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;;3
ff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# frozen_string_literal: true

# Redmine - project management software
# Copyright (C) 2006-  Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

module IssueRelationsHelper
  def collection_for_relation_type_select
    values = IssueRelation::TYPES
    values.keys.sort_by{|k| values[k][:order]}.collect{|k| [l(values[k][:name]), k]}
  end

  def relation_error_messages(relations)
    messages = {}
    relations.each do |item|
      item.errors.full_messages.each do |message|
        messages[message] ||= []
        messages[message] << item
      end
    end

    messages.map do |message, items|
      ids = items.filter_map(&:issue_to_id)
      if ids.empty?
        message
      else
        "#{message}: ##{ids.join(', ')}"
      end
    end
  end
end