| 
									
										
										
										
											2011-07-23 18:18:13 +00:00
										 |  |  | # Redmine - project management software | 
					
						
							| 
									
										
										
										
											2013-01-12 09:29:31 +00:00
										 |  |  | # Copyright (C) 2006-2013  Jean-Philippe Lang | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00: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 14:12:20 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00: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 14:12:20 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00: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 11:53:43 +00:00
										 |  |  |   menu_item :issues | 
					
						
							| 
									
										
										
										
											2010-02-11 16:42:52 +00:00
										 |  |  |   before_filter :find_project, :authorize, :find_issue_statuses | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def issue_report | 
					
						
							| 
									
										
										
										
											2010-02-08 17:53:58 +00:00
										 |  |  |     @trackers = @project.trackers | 
					
						
							|  |  |  |     @versions = @project.shared_versions.sort | 
					
						
							| 
									
										
										
										
											2012-06-20 19:24:58 +00:00
										 |  |  |     @priorities = IssuePriority.all.reverse | 
					
						
							| 
									
										
										
										
											2010-02-08 17:53:58 +00:00
										 |  |  |     @categories = @project.issue_categories | 
					
						
							| 
									
										
										
										
											2011-07-23 18:18:13 +00:00
										 |  |  |     @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort | 
					
						
							|  |  |  |     @authors = @project.users.sort | 
					
						
							| 
									
										
										
										
											2010-04-27 16:43:52 +00:00
										 |  |  |     @subprojects = @project.descendants.visible | 
					
						
							| 
									
										
										
										
											2010-02-10 16:59:58 +00: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 17:53:58 +00:00
										 |  |  |     render :template => "reports/issue_report" | 
					
						
							| 
									
										
										
										
											2011-08-30 14:12:20 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2010-02-08 17:53:58 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def issue_report_details | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |     case params[:detail] | 
					
						
							|  |  |  |     when "tracker" | 
					
						
							|  |  |  |       @field = "tracker_id" | 
					
						
							| 
									
										
										
										
											2007-11-20 20:29:03 +00:00
										 |  |  |       @rows = @project.trackers | 
					
						
							| 
									
										
										
										
											2010-02-10 16:59:58 +00:00
										 |  |  |       @data = Issue.by_tracker(@project) | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |       @report_title = l(:field_tracker) | 
					
						
							| 
									
										
										
										
											2007-05-26 16:06:02 +00:00
										 |  |  |     when "version" | 
					
						
							|  |  |  |       @field = "fixed_version_id" | 
					
						
							| 
									
										
										
										
											2009-12-18 14:59:19 +00:00
										 |  |  |       @rows = @project.shared_versions.sort | 
					
						
							| 
									
										
										
										
											2010-02-10 16:59:58 +00:00
										 |  |  |       @data = Issue.by_version(@project) | 
					
						
							| 
									
										
										
										
											2007-05-26 16:06:02 +00:00
										 |  |  |       @report_title = l(:field_version) | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |     when "priority" | 
					
						
							|  |  |  |       @field = "priority_id" | 
					
						
							| 
									
										
										
										
											2012-06-20 19:24:58 +00:00
										 |  |  |       @rows = IssuePriority.all.reverse | 
					
						
							| 
									
										
										
										
											2010-02-10 16:59:58 +00:00
										 |  |  |       @data = Issue.by_priority(@project) | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |       @report_title = l(:field_priority) | 
					
						
							|  |  |  |     when "category" | 
					
						
							|  |  |  |       @field = "category_id" | 
					
						
							|  |  |  |       @rows = @project.issue_categories | 
					
						
							| 
									
										
										
										
											2010-02-10 16:59:58 +00:00
										 |  |  |       @data = Issue.by_category(@project) | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |       @report_title = l(:field_category) | 
					
						
							| 
									
										
										
										
											2008-01-10 19:20:36 +00:00
										 |  |  |     when "assigned_to" | 
					
						
							|  |  |  |       @field = "assigned_to_id" | 
					
						
							| 
									
										
										
										
											2011-07-23 18:18:13 +00:00
										 |  |  |       @rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort | 
					
						
							| 
									
										
										
										
											2010-02-10 16:59:58 +00:00
										 |  |  |       @data = Issue.by_assigned_to(@project) | 
					
						
							| 
									
										
										
										
											2008-01-10 19:20:36 +00:00
										 |  |  |       @report_title = l(:field_assigned_to) | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |     when "author" | 
					
						
							|  |  |  |       @field = "author_id" | 
					
						
							| 
									
										
										
										
											2011-07-23 18:18:13 +00:00
										 |  |  |       @rows = @project.users.sort | 
					
						
							| 
									
										
										
										
											2010-02-10 16:59:58 +00:00
										 |  |  |       @data = Issue.by_author(@project) | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |       @report_title = l(:field_author) | 
					
						
							| 
									
										
										
										
											2007-04-03 19:48:49 +00:00
										 |  |  |     when "subproject" | 
					
						
							|  |  |  |       @field = "project_id" | 
					
						
							| 
									
										
										
										
											2010-04-27 16:43:52 +00:00
										 |  |  |       @rows = @project.descendants.visible | 
					
						
							| 
									
										
										
										
											2010-02-10 16:59:58 +00:00
										 |  |  |       @data = Issue.by_subproject(@project) || [] | 
					
						
							| 
									
										
										
										
											2007-04-03 19:48:49 +00:00
										 |  |  |       @report_title = l(:field_subproject) | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2010-02-08 17:53:58 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-09 16:47:27 +00:00
										 |  |  |     respond_to do |format| | 
					
						
							|  |  |  |       if @field | 
					
						
							|  |  |  |         format.html {} | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         format.html { redirect_to :action => 'issue_report', :id => @project } | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2010-02-08 17:53:58 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2007-05-26 16:06:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-11 16:42:52 +00:00
										 |  |  |   private | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def find_issue_statuses | 
					
						
							| 
									
										
										
										
											2012-12-02 19:09:42 +00:00
										 |  |  |     @statuses = IssueStatus.sorted.all | 
					
						
							| 
									
										
										
										
											2010-02-11 16:42:52 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2006-06-28 18:11:03 +00:00
										 |  |  | end |