Commit af50c554 authored by jplang's avatar jplang

Set default date format based on user locale (#950).

git-svn-id: https://svn.redmine.org/redmine/trunk@14496 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 1bbda943
......@@ -59,10 +59,14 @@ class Import < ActiveRecord::Base
wrapper = '"'
encoding = lu(user, :general_csv_encoding)
date_format = lu(user, "date.formats.default", :default => "foo")
date_format = DATE_FORMATS.first unless DATE_FORMATS.include?(date_format)
self.settings.merge!(
'separator' => separator,
'wrapper' => wrapper,
'encoding' => encoding
'encoding' => encoding,
'date_format' => date_format
)
end
......
......@@ -92,6 +92,16 @@ class IssueImportTest < ActiveSupport::TestCase
assert_equal '2015-07-14', issue.custom_field_value(field)
end
def test_date_format_should_default_to_user_language
user = User.generate!(:language => 'fr')
import = Import.new
import.user = user
assert_nil import.settings['date_format']
import.set_default_settings
assert_equal '%d/%m/%Y', import.settings['date_format']
end
def test_run_should_remove_the_file
import = generate_import_with_mapping
file_path = import.filepath
......
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