summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2020-04-05 08:29:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2020-04-05 08:29:15 +0000
commit9fcfeb1b363cefa8ecf710e3bdcc4c0f79e517cd (patch)
treebb1d4b8958764c47f8e39300f2ae53562d96228e
parent2b122d2b650c4164d21d753e3121c8700739569f (diff)
downloadredmine-9fcfeb1b363cefa8ecf710e3bdcc4c0f79e517cd.tar.gz
redmine-9fcfeb1b363cefa8ecf710e3bdcc4c0f79e517cd.zip
Editing time entries should show the time entry user (#3800).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@19653 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/views/timelog/_form.html.erb6
-rw-r--r--test/functional/timelog_controller_test.rb7
2 files changed, 13 insertions, 0 deletions
diff --git a/app/views/timelog/_form.html.erb b/app/views/timelog/_form.html.erb
index bfeb67337..24bce8b6d 100644
--- a/app/views/timelog/_form.html.erb
+++ b/app/views/timelog/_form.html.erb
@@ -16,8 +16,14 @@
<%= link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>
</span>
</p>
+
<% if User.current.allowed_to?(:log_time_for_other_users, @project) %>
<p><%= f.select :user_id, user_collection_for_select_options(@time_entry), :required => true %></p>
+ <% elsif !@time_entry.new_record? %>
+ <p>
+ <%= f.label_for_field :user_id %>
+ <span><%= link_to_user(@time_entry.user) %></span>
+ </p>
<% end %>
<p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
<p><%= f.hours_field :hours, :size => 6, :required => true %></p>
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 24dbc9332..ce5ad6110 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -46,6 +46,8 @@ class TimelogControllerTest < Redmine::ControllerTest
# blank option for project
assert_select 'option[value=""]'
end
+ assert_select 'label[for=?]', 'time_entry_user_id', 0
+ assert_select 'select[name=?]', 'time_entry[user_id]', 0
end
def test_new_with_project_id
@@ -150,6 +152,11 @@ class TimelogControllerTest < Redmine::ControllerTest
assert_response :success
assert_select 'form[action=?]', '/time_entries/2'
+
+ # Time entry user should be shown as text
+ # for user without permission to log time for other users
+ assert_select 'label[for=?]', 'time_entry_user_id', 1
+ assert_select 'a.user.active', :text => 'Redmine Admin'
end
def test_get_edit_with_an_existing_time_entry_with_inactive_activity