How to prevent users Log time on closed issues?
Added by Dmitriy Perfilyev over 9 years ago
Hi
How I can prevent users Log time on closed issues?
Replies (17)
RE: How to prevent users Log time on closed issues? - Added by Leonel Iturralde over 9 years ago
Im using redmine-3.0.0 and the default role reporter cannot log time on closed issues.
RE: How to prevent users Log time on closed issues? - Added by Dmitriy Perfilyev over 9 years ago
This is because user under the reporter role can not log time on any issues.
RE: How to prevent users Log time on closed issues? - Added by Leonel Iturralde over 9 years ago
Dmitriy Perfilyev wrote:
This is because user under the reporter role can not log time on any issues.
Thank for telling me. Maybe I changed my config but my reporter can log time.
I wrote:
Im using redmine-3.0.0 and the default role reporter cannot log time on closed issues.
I think I got confused with which role the user had the first time. Sorry.
You are right if user has permission to log time it can log time even after the issued is closed.
RE: How to prevent users Log time on closed issues? - Added by Pavel Potcheptsov over 9 years ago
In my case Closed issue has ID 5. Check in the database what ID in your case.
Hope this help. Restart after edit.
===================================================================
--- app/views/issues/_action_menu.html.erb (revision 13520)
+++ app/views/issues/_action_menu.html.erb (working copy)
@@ -1,6 +1,8 @@
<div class="contextual">
-<%= link_to l(:button_edit), edit_issue_path(@issue), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %>
-<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
+<%= link_to l(:button_update), edit_issue_path(@issue), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %>
+<%= if @issue.status_id != 5
+link_to l(:button_log_time), new_issue_time_entry_path(@issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project)
+end %>
<%= watcher_link(@issue, User.current) %>
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %>
<%= link_to l(:button_delete), issue_path(@issue), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %>
Index: app/views/issues/_edit.html.erb
===================================================================
--- app/views/issues/_edit.html.erb (revision 13520)
+++ app/views/issues/_edit.html.erb (working copy)
@@ -9,7 +9,7 @@
</div>
</fieldset>
<% end %>
- <% if User.current.allowed_to?(:log_time, @project) %>
+ <% if User.current.allowed_to?(:log_time, @project) && @issue.status_id != 5 %>
<fieldset class="tabular"><legend><%= l(:button_log_time) %></legend>
<%= labelled_fields_for :time_entry, @time_entry do |time_entry| %>
<div class="splitcontentleft">
RE: How to prevent users Log time on closed issues? - Added by Dmitriy Perfilyev over 9 years ago
Thank you. It would be more convenient to restrict Log time on closed issues at the controller level
RE: How to prevent users Log time on closed issues? - Added by Shane Coronado almost 8 years ago
I've been looking for a more convenient way to prevent users from logging time to closed issues.
RE: How to prevent users Log time on closed issues? - Added by Shane Coronado almost 8 years ago
Pavel Potcheptsov wrote:
In my case Closed issue has ID 5. Check in the database what ID in your case.
Hope this help. Restart after edit.
[...]
Thank you Pavel, works as intended!
RE: How to prevent users Log time on closed issues? - Added by ivan perez over 7 years ago
Sorry... but i tried to apply the changes you suggest and i get an internal error :(... i have redmine 3.2.2-0 in spanish
RE: How to prevent users Log time on closed issues? - Added by Jürgen Depicker over 7 years ago
Is this not incorrect? Should the behaviour not be that logging time to closed issues is impossible? When I close an issue, I don't want developers to work on it, nor log time...
RE: How to prevent users Log time on closed issues? - Added by Gabriel Alessandria over 6 years ago
Hi pavel ochman Potcheptsov
I'm from Argentina .. it is an excelent solution to prevent that logging time on closed issues !!
Thanks a lot !
RE: How to prevent users Log time on closed issues? - Added by Pavel Potcheptsov over 6 years ago
I'm glad it works for you.
RE: How to prevent users Log time on closed issues? - Added by Murray Jones over 6 years ago
This is done by going into your Permisssion Scheme and changing the "Resolve Issues" Project Permission to include only the people you want to be able to "resolve" or "reopen" and issue.
This could be problematic if you have allowed everyone to resolve an issue. Just remember that "resolving" and closing are two different functions. So, I would say, change your Resolve Issue permissions and see if that fixes your issue. It sounds like you are not using "resolve" in your workflow so it is going to be OK.
RE: How to prevent users Log time on closed issues? - Added by Pavel Potcheptsov over 6 years ago
This talk is about how to prevent users to log time in Closed/Resolved issues. Not about how to prevent users to Close/Resolve issues.
RE: How to prevent users Log time on closed issues? - Added by Marcelo Carmizini almost 5 years ago
Hello,
Is there any setting in redmine so that the user does not post hours on closed tasks?
Tanks!
RE: How to prevent users Log time on closed issues? - Added by Marius BĂLTEANU almost 5 years ago
There is not such option right now, only an old request, please see #13596.
RE: How to prevent users Log time on closed issues? - Added by Jan K. almost 5 years ago
We need it as well!
RE: How to prevent users Log time on closed issues? - Added by Stefan Lindner almost 4 years ago
The patches still work with 4.1.1
We added another patch for the context menu to prevent time entries.
And we modified the patches a little bit: not only for @issue.status_id != 5
but any closed state
Here are the patches:
app/views/issues/_action_menu.html.erb
@@ -1,9 +1,14 @@ <div class="contextual"> + <%= link_to l(:button_edit), edit_issue_path(@issue), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %> + +<% if @issue.closed? == false %> <%= link_to l(:button_log_time), new_issue_time_entry_path(@issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %> +<% end %> + <%= watcher_link(@issue, User.current) %> <%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
app/views/issues/_edit.html.erb
@@ -10,6 +10,7 @@ </fieldset> <% end %> <% if User.current.allowed_to?(:log_time, @project) %> + <% if @issue.closed? == false %> <fieldset class="tabular"><legend><%= l(:button_log_time) %></legend> <%= labelled_fields_for :time_entry, @time_entry do |time_entry| %> <div class="splitcontent"> @@ -25,7 +26,8 @@ <p><%= custom_field_tag_with_label :time_entry, value %></p> <% end %> <% end %> - </fieldset> + </fieldset> + <% end %> <% end %> <% if @issue.notes_addable? %> <fieldset><legend><%= l(:field_notes) %></legend>
app/controllers/context_menus_controller.rb
@@ -32,7 +32,7 @@ @allowed_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&) @can = {:edit => @issues.all?(&:attributes_editable?), - :log_time => (@project && User.current.allowed_to?(:log_time, @project)), + :log_time => (@project && User.current.allowed_to?(:log_time, @project) && @issue.closed? == false), :copy => User.current.allowed_to?(:copy_issues, @projects) && Issue.allowed_target_projects.any?, :add_watchers => User.current.allowed_to?(:add_issue_watchers, @projects), :delete => @issues.all?(&:deletable?)
I'm not a native ruby/rails speaker so it might be a little bit too cumbersome.
But it works for us...