Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed to support redmine 3.0.3 #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions app/controllers/importer_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def handle_custom_fields(add_versions, issue, project, row)
value = row[@attrs_map[cf.name]]
unless value.blank?
if cf.multiple
h[cf.id] = process_multivalue_custom_field(issue, cf, value)
h[cf.id] = process_multivalue_custom_field(project, add_versions, issue, cf, value)
else
begin
value = case cf.field_format
Expand Down Expand Up @@ -629,11 +629,11 @@ def issue_for_unique_attr(unique_attr, attr_value, row_data)
query.add_filter("status_id", "*", [1])
query.add_filter(unique_attr, "=", [attr_value])

issues = Issue.find :all,
:conditions => query.statement,
:limit => 2,
:include => [ :assigned_to, :status, :tracker, :project, :priority,
:category, :fixed_version ]
issues = Issue.joins([:project])
.includes([ :assigned_to, :status, :tracker, :project, :priority,
:category, :fixed_version ])
.limit(2)
.where(query.statement)
end

if issues.size > 1
Expand All @@ -643,7 +643,7 @@ def issue_for_unique_attr(unique_attr, attr_value, row_data)
"'#{attr_value}' in issue #{@failed_count} has duplicate record"
raise MultipleIssuesForUniqueValue, "Unique field #{unique_attr} with" \
" value '#{attr_value}' has duplicate record"
elsif issues.size == 0 || issue[0].nil?
elsif issues.size == 0 || issues[0].nil?
raise NoIssueForUniqueValue, "No issue with #{unique_attr} of '#{attr_value}' found"
else
issues.first
Expand Down Expand Up @@ -697,11 +697,11 @@ def version_id_for_name!(project,name,add_versions)
@version_id_by_name[name]
end

def process_multivalue_custom_field(issue, custom_field, csv_val)
def process_multivalue_custom_field(project, add_versions, issue, custom_field, csv_val)
csv_val.split(',').map(&:strip).map do |val|
if custom_field.field_format == 'version'
version = version_id_for_name!(project, val, add_versions)
version.id
version
else
val
end
Expand Down