Use 'user' as internal field instead of user_id because the column accepts also user login as value, not only the id (#22913).

Patch by Marius BALTEANU.


git-svn-id: http://svn.redmine.org/redmine/trunk@19523 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2020-02-19 14:31:39 +00:00
parent 5873af5ae3
commit 4d341f0f14
5 changed files with 8 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
row;issue_id;date;hours;comment;activity;overtime;user_id
row;issue_id;date;hours;comment;activity;overtime;user
1;;2020-01-01;1;Some Design;Design;yes;jsmith@somenet.foo
2;;2020-01-02;2;Some Development;Development;yes;jsmith@somenet.foo
3;1;2020-01-03;3;Some QA;QA;no;dlopper@somenet.foo
1 row issue_id date hours comment activity overtime user_id user
2 1 2020-01-01 1 Some Design Design yes jsmith@somenet.foo jsmith@somenet.foo
3 2 2020-01-02 2 Some Development Development yes jsmith@somenet.foo jsmith@somenet.foo
4 3 1 2020-01-03 3 Some QA QA no dlopper@somenet.foo dlopper@somenet.foo

View File

@@ -202,7 +202,7 @@ class ImportsControllerTest < Redmine::ControllerTest
# 'user_id' field should be available because User#2 has both
# 'import_time_entries' and 'log_time_for_other_users' permissions
assert_select 'select[name=?]', 'import_settings[mapping][user_id]' do
assert_select 'select[name=?]', 'import_settings[mapping][user]' do
# Current user should be the default value
assert_select 'option[value="value:2"][selected]', :text => User.find(2).name
assert_select 'option[value="value:3"]', :text => User.find(3).name

View File

@@ -140,7 +140,7 @@ class TimeEntryImportTest < ActiveSupport::TestCase
def test_maps_user_to_column_value
User.current = User.find(1)
import = generate_import_with_mapping
import.mapping.merge!('user_id' => 'value:1')
import.mapping.merge!('user' => 'value:1')
import.save!
first, second, third, fourth = new_records(TimeEntry, 4) { import.run }
@@ -185,7 +185,7 @@ class TimeEntryImportTest < ActiveSupport::TestCase
'spent_on' => '2',
'hours' => '3',
'comments' => '4',
'user_id' => '7'
'user' => '7'
}
}
import.save!