2011-07-23 22:18:13 +04:00
|
|
|
# Redmine - project management software
|
2014-01-30 02:45:39 +04:00
|
|
|
# Copyright (C) 2006-2014 Jean-Philippe Lang
|
2007-03-12 20:59:02 +03:00
|
|
|
#
|
|
|
|
# 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.
|
2011-08-30 18:12:20 +04:00
|
|
|
#
|
2007-03-12 20:59:02 +03:00
|
|
|
# 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.
|
2011-08-30 18:12:20 +04:00
|
|
|
#
|
2007-03-12 20:59:02 +03:00
|
|
|
# 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
|
2010-02-11 19:42:52 +03:00
|
|
|
before_filter :find_project, :authorize, :find_issue_statuses
|
2007-03-12 20:59:02 +03:00
|
|
|
|
|
|
|
def issue_report
|
2010-02-08 20:53:58 +03:00
|
|
|
@trackers = @project.trackers
|
|
|
|
@versions = @project.shared_versions.sort
|
2012-06-20 23:24:58 +04:00
|
|
|
@priorities = IssuePriority.all.reverse
|
2010-02-08 20:53:58 +03:00
|
|
|
@categories = @project.issue_categories
|
2011-07-23 22:18:13 +04:00
|
|
|
@assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
|
|
|
|
@authors = @project.users.sort
|
2010-04-27 20:43:52 +04:00
|
|
|
@subprojects = @project.descendants.visible
|
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"
|
2011-08-30 18:12:20 +04:00
|
|
|
end
|
2010-02-08 20:53:58 +03:00
|
|
|
|
|
|
|
def issue_report_details
|
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"
|
2012-06-20 23:24:58 +04:00
|
|
|
@rows = IssuePriority.all.reverse
|
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"
|
2011-07-23 22:18:13 +04:00
|
|
|
@rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).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"
|
2011-07-23 22:18:13 +04:00
|
|
|
@rows = @project.users.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"
|
2010-04-27 20:43:52 +04:00
|
|
|
@rows = @project.descendants.visible
|
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
|
|
|
|
2010-02-11 19:42:52 +03:00
|
|
|
private
|
|
|
|
|
|
|
|
def find_issue_statuses
|
2012-12-02 23:09:42 +04:00
|
|
|
@statuses = IssueStatus.sorted.all
|
2010-02-11 19:42:52 +03:00
|
|
|
end
|
2006-06-28 22:11:03 +04:00
|
|
|
end
|