Browse Source

Identify time entry user just like issue assignee (#32196).

git-svn-id: http://svn.redmine.org/redmine/trunk@18891 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.1.0
Jean-Philippe Lang 4 years ago
parent
commit
a7ffe39289
2 changed files with 9 additions and 5 deletions
  1. 5
    1
      app/models/time_entry_import.rb
  2. 4
    4
      test/fixtures/files/import_time_entries.csv

+ 5
- 1
app/models/time_entry_import.rb View File

@@ -86,7 +86,11 @@ class TimeEntryImport < Import

user_id = nil
if User.current.allowed_to?(:log_time_for_other_users, project)
user_id = user_value || row_value(row, 'user_id')
if user_value
user_id = user_value
elsif user_name = row_value(row, 'user_id')
user_id = Principal.detect_by_keyword(allowed_target_users, user_name).try(:id)
end
else
user_id = user.id
end

+ 4
- 4
test/fixtures/files/import_time_entries.csv View File

@@ -1,5 +1,5 @@
row;issue_id;date;hours;comment;activity;overtime;user_id
1;;2020-01-01;1;Some Design;Design;yes;2
2;;2020-01-02;2;Some Development;Development;yes;2
3;1;2020-01-03;3;Some QA;QA;no;3
4;2;2020-01-04;4;Some Inactivity;Inactive Activity;no;2
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
4;2;2020-01-04;4;Some Inactivity;Inactive Activity;no;jsmith@somenet.foo

Loading…
Cancel
Save