Project

General

Profile

Actions

Patch #5894

closed

Allow bulk status change

Added by Peter Höpfl almost 14 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
-
Start date:
2010-07-16
Due date:
% Done:

0%

Estimated time:

Description

We run a big Redmine installation with more than 20000 tickets. What we are missing is the ability to change the status of several issues (especially closing issues) at once.

For Redmine version 0.9.4 I made a patch that makes this possible and now I would like to contribute this patch to all Redmine users.
Unfortunately I have no svn access to provide an official patch file. Also I don't know if my code (first Ruby code) is ok.

Here is what i did:

File app/controllers/issues_controller.rb, Line 412ff:

Old:
  def context_menu
    @issues = Issue.find_all_by_id(params[:ids], :include => :project)
    if (@issues.size == 1)
      @issue = @issues.first
      @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
    end
    projects = @issues.collect(&:project).compact.uniq
    @project = projects.first if projects.size == 1

    @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),

New:

  def context_menu
    @issues = Issue.find_all_by_id(params[:ids], :include => :project)
    if (@issues.size == 1)
      @issue = @issues.first
      @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
    end
    projects = @issues.collect(&:project).compact.uniq
    @project = projects.first if projects.size == 1

#Patch HOE for context menue
    if (projects.size == 1)
      @issue = @issues.first
      @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
    end
#End Patch HOE for context menue

    @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),


File app/views/issues/context_menu.rhtml, Line 10ff:

Old:
                <% @statuses.each do |s| -%>
                    <li><%= context_menu_link s.name, {:controller => 'issues', :action => 'edit', :id => @issue, :issue => {:status_id => s}, :back_url => @back}, :method => :post,
                                              :selected => (s == @issue.status), :disabled => !(@can[:update] && @allowed_statuses.include?(s)) %></li>
                <% end -%>

New:

                <% @statuses.each do |s| -%>
                    <li><%= context_menu_link s.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'status_id' => s, :back_url => @back}, :method => :post,
                                              :selected => (s == @issue.status), :disabled => !(@can[:update] && @allowed_statuses.include?(s)) %></li>
                <% end -%>

It would be great if you would integrate this code into Redmine.

Thanks,

Peter


Related issues

Related to Redmine - Defect #5892: Changing status from contextual menu opens the ticket insteadClosed2010-07-16

Actions
Actions #1

Updated by Mischa The Evil almost 14 years ago

  • Tracker changed from Feature to Patch
  • Category set to Issues
Fixed and corrected:
  • Tracker
  • Description
  • Category
Changed issue-relations:
  • added; "related to" #5892
Actions #2

Updated by Felix Schäfer over 13 years ago

  • Status changed from New to Closed

Peter, from what a quick can gather I think your problem was related to not being able to use the context menu to change the status, correct? This has been corrected for #5892 and is in current trunk and 1.0-stable.

Actions #3

Updated by Peter Höpfl over 13 years ago

  • Status changed from Closed to Reopened

Hello Felix,

no, Ticket #5892 is only one half of my suggested patch:
Ticket #5892 enables the user to change the status as a bulk action.

But my patch in the app/controllers/issues_controller.rb at last makes it possible to change the status of MORE THAN ONE ticket at once.

The logic in the issues_controller is like this:
First there is a check if only one issue is selected. Only if that is the case the context menu for status changes is enabled.
But that also means that if you select more than one ticket the option to change the status of several tickets at once is gone!
My patch in the controller changes the behavior:
It checks if all selected issues belong to the same project – in that case the permission check is the same as for one ticket – and if yes and the user has correct permissions it enables the status change feature by setting the variable @issue to the first select issue.

@issue is later the precondition to show the status change menu entry in the context_menu and the change in #5892 makes the bulk action itself correctly executed.

I see no reason why one should not be allowed to change the status of <n> tickets in one project at once...

Actions #4

Updated by Felix Schäfer over 13 years ago

  • Subject changed from Allow bulk actions for issues in one project, especially status changes to Allow bulk status change
  • Assignee set to Jean-Philippe Lang

Peter: could you post your proposed changes as a diff (diff -u original_file modified_file for example, or svn diff or svn diff some_file if you have checked out redmine from svn), they're much more readable, thanks. Also, I just had a closer look at the patch and it will show the allowed statuses for the first issue in the list, but suppose you select issues from 2 different trackers, say a Bug and a Patch, and the roles you have allow you to close Bugs but not Patches, then the menu will show you the Closed status (if the first issue is a Bug) although you can't close patches.

JPLang: As it was your code limiting the status changes, I'll let you tackle this one.

Regarding the limitation to only one project: I don't think it's necessary as long as you collect the allowed statuses for each issue and make the intersection of those, that way you'd end up with statuses the user can reach for every issue.

Actions #5

Updated by Peter Höpfl over 13 years ago

Alright, my patch is definitly not usable as a final solution:
I forgot the fact that also within one project issues for different trackers with different rights can exist.
I simply took the first issue, checked the user rights and then allowed the bulk change (that works in our installation, because we have identical rights for all trackers in one project).

JPLang: Maybe you know a way to collect the allowed statuses for all selected issues and provide a patch that solves this better than my approach...

Actions #6

Updated by Cyber Sprocket over 13 years ago

Users that are logged in as administrator should be allowed to ALWAYS bulk upload status codes.

As an admin I can see tasks but then I cannot edit them unless I go into the project and add myself as a member. That adds extra work when trying to clean up tasks or organize projects.

Actions #7

Updated by Filou Centrinov about 11 years ago

It's fixed, isn't it?
Peter Demais Höpfl: Please upgrade your Redmine to use this function.

Actions #8

Updated by Peter Höpfl about 11 years ago

Yes, it is fixed. We already use the updated version.
So please close this ticket.

Actions #9

Updated by Toshi MARUYAMA about 11 years ago

  • Status changed from Reopened to Closed

Peter Höpfl wrote:

Yes, it is fixed. We already use the updated version.
So please close this ticket.

Thank you for your feedback.

Actions

Also available in: Atom PDF