2007-03-12 20:59:02 +03:00
|
|
|
# redMine - project management software
|
|
|
|
# Copyright (C) 2006 Jean-Philippe Lang
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
class ReportsController < ApplicationController
|
2008-01-19 14:53:43 +03:00
|
|
|
menu_item :issues
|
2007-03-12 20:59:02 +03:00
|
|
|
before_filter :find_project, :authorize
|
|
|
|
|
|
|
|
def issue_report
|
|
|
|
@statuses = IssueStatus.find(:all, :order => 'position')
|
|
|
|
|
2010-02-08 20:53:58 +03:00
|
|
|
@trackers = @project.trackers
|
|
|
|
@versions = @project.shared_versions.sort
|
|
|
|
@priorities = IssuePriority.all
|
|
|
|
@categories = @project.issue_categories
|
|
|
|
@assignees = @project.members.collect { |m| m.user }.sort
|
|
|
|
@authors = @project.members.collect { |m| m.user }.sort
|
|
|
|
@subprojects = @project.descendants.active
|
2010-02-10 19:59:58 +03:00
|
|
|
|
|
|
|
@issues_by_tracker = Issue.by_tracker(@project)
|
|
|
|
@issues_by_version = Issue.by_version(@project)
|
|
|
|
@issues_by_priority = Issue.by_priority(@project)
|
|
|
|
@issues_by_category = Issue.by_category(@project)
|
|
|
|
@issues_by_assigned_to = Issue.by_assigned_to(@project)
|
|
|
|
@issues_by_author = Issue.by_author(@project)
|
|
|
|
@issues_by_subproject = Issue.by_subproject(@project) || []
|
|
|
|
|
2010-02-08 20:53:58 +03:00
|
|
|
render :template => "reports/issue_report"
|
|
|
|
end
|
|
|
|
|
|
|
|
def issue_report_details
|
|
|
|
@statuses = IssueStatus.find(:all, :order => 'position')
|
|
|
|
|
2007-03-12 20:59:02 +03:00
|
|
|
case params[:detail]
|
|
|
|
when "tracker"
|
|
|
|
@field = "tracker_id"
|
2007-11-20 23:29:03 +03:00
|
|
|
@rows = @project.trackers
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_tracker(@project)
|
2007-03-12 20:59:02 +03:00
|
|
|
@report_title = l(:field_tracker)
|
2007-05-26 20:06:02 +04:00
|
|
|
when "version"
|
|
|
|
@field = "fixed_version_id"
|
2009-12-18 17:59:19 +03:00
|
|
|
@rows = @project.shared_versions.sort
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_version(@project)
|
2007-05-26 20:06:02 +04:00
|
|
|
@report_title = l(:field_version)
|
2007-03-12 20:59:02 +03:00
|
|
|
when "priority"
|
|
|
|
@field = "priority_id"
|
2009-05-31 03:30:36 +04:00
|
|
|
@rows = IssuePriority.all
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_priority(@project)
|
2007-03-12 20:59:02 +03:00
|
|
|
@report_title = l(:field_priority)
|
|
|
|
when "category"
|
|
|
|
@field = "category_id"
|
|
|
|
@rows = @project.issue_categories
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_category(@project)
|
2007-03-12 20:59:02 +03:00
|
|
|
@report_title = l(:field_category)
|
2008-01-10 22:20:36 +03:00
|
|
|
when "assigned_to"
|
|
|
|
@field = "assigned_to_id"
|
2010-01-17 14:07:53 +03:00
|
|
|
@rows = @project.members.collect { |m| m.user }.sort
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_assigned_to(@project)
|
2008-01-10 22:20:36 +03:00
|
|
|
@report_title = l(:field_assigned_to)
|
2007-03-12 20:59:02 +03:00
|
|
|
when "author"
|
|
|
|
@field = "author_id"
|
2010-01-17 14:07:53 +03:00
|
|
|
@rows = @project.members.collect { |m| m.user }.sort
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_author(@project)
|
2007-03-12 20:59:02 +03:00
|
|
|
@report_title = l(:field_author)
|
2007-04-03 23:48:49 +04:00
|
|
|
when "subproject"
|
|
|
|
@field = "project_id"
|
2009-01-24 14:31:15 +03:00
|
|
|
@rows = @project.descendants.active
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_subproject(@project) || []
|
2007-04-03 23:48:49 +04:00
|
|
|
@report_title = l(:field_subproject)
|
2007-03-12 20:59:02 +03:00
|
|
|
end
|
2010-02-08 20:53:58 +03:00
|
|
|
|
2010-02-09 19:47:27 +03:00
|
|
|
respond_to do |format|
|
|
|
|
if @field
|
|
|
|
format.html {}
|
|
|
|
else
|
|
|
|
format.html { redirect_to :action => 'issue_report', :id => @project }
|
|
|
|
end
|
|
|
|
end
|
2010-02-08 20:53:58 +03:00
|
|
|
end
|
2007-05-26 20:06:02 +04:00
|
|
|
|
2006-06-28 22:11:03 +04:00
|
|
|
end
|