summaryrefslogtreecommitdiffstats
path: root/app/models/issue_import.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-08-14 15:42:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-08-14 15:42:28 +0000
commit722eaed7216270d8e89f50c92abb1cfaf9bf1503 (patch)
tree17c0bbc3ffe492d4bdb1e2154f158afac46bee43 /app/models/issue_import.rb
parentfe24da53e7841fdb76651c8fa3abd561fa97cf7f (diff)
downloadredmine-722eaed7216270d8e89f50c92abb1cfaf9bf1503.tar.gz
redmine-722eaed7216270d8e89f50c92abb1cfaf9bf1503.zip
Adds support for custom date format when importing a CSV file (#950).
git-svn-id: http://svn.redmine.org/redmine/trunk@14495 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_import.rb')
-rw-r--r--app/models/issue_import.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/issue_import.rb b/app/models/issue_import.rb
index 2ff127605..7a7cf1e83 100644
--- a/app/models/issue_import.rb
+++ b/app/models/issue_import.rb
@@ -122,10 +122,10 @@ class IssueImport < Import
attributes['parent_issue_id'] = parent_issue_id
end
end
- if start_date = row_value(row, 'start_date')
+ if start_date = row_date(row, 'start_date')
attributes['start_date'] = start_date
end
- if due_date = row_value(row, 'due_date')
+ if due_date = row_date(row, 'due_date')
attributes['due_date'] = due_date
end
if done_ratio = row_value(row, 'done_ratio')
@@ -133,7 +133,13 @@ class IssueImport < Import
end
attributes['custom_field_values'] = issue.custom_field_values.inject({}) do |h, v|
- if value = row_value(row, "cf_#{v.custom_field.id}")
+ value = case v.custom_field.field_format
+ when 'date'
+ row_date(row, "cf_#{v.custom_field.id}")
+ else
+ row_value(row, "cf_#{v.custom_field.id}")
+ end
+ if value
h[v.custom_field.id.to_s] = v.custom_field.value_from_keyword(value, issue)
end
h