| 
									
										
										
										
											2019-03-16 09:37:35 +00:00
										 |  |  | # frozen_string_literal: true | 
					
						
							| 
									
										
										
										
											2019-03-15 01:32:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-23 18:18:13 +00:00
										 |  |  | # Redmine - project management software | 
					
						
							| 
									
										
										
										
											2021-03-25 06:58:56 +00:00
										 |  |  | # Copyright (C) 2006-2021  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 | 
					
						
							| 
									
										
										
										
											2016-07-14 07:27:31 +00:00
										 |  |  |   before_action :find_project, :authorize, :find_issue_statuses | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def issue_report | 
					
						
							| 
									
										
										
										
											2020-11-16 14:21:25 +00:00
										 |  |  |     with_subprojects = Setting.display_subprojects_issues? | 
					
						
							|  |  |  |     @trackers = @project.rolled_up_trackers(with_subprojects).visible | 
					
						
							| 
									
										
										
										
											2021-12-12 04:40:32 +00:00
										 |  |  |     @versions = @project.shared_versions.sorted + [Version.new(:name => "[#{l(:label_none)}]")] | 
					
						
							| 
									
										
										
										
											2012-06-20 19:24:58 +00:00
										 |  |  |     @priorities = IssuePriority.all.reverse | 
					
						
							| 
									
										
										
										
											2021-12-12 04:40:32 +00:00
										 |  |  |     @categories = @project.issue_categories + [IssueCategory.new(:name => "[#{l(:label_none)}]")] | 
					
						
							|  |  |  |     @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted + [User.new(:firstname => "[#{l(:label_none)}]")] | 
					
						
							| 
									
										
										
										
											2018-12-02 22:31:44 +00:00
										 |  |  |     @authors = @project.users.sorted | 
					
						
							| 
									
										
										
										
											2010-04-27 16:43:52 +00:00
										 |  |  |     @subprojects = @project.descendants.visible | 
					
						
							| 
									
										
										
										
											2018-10-03 07:16:47 +00:00
										 |  |  |     @issues_by_tracker = Issue.by_tracker(@project, with_subprojects) | 
					
						
							|  |  |  |     @issues_by_version = Issue.by_version(@project, with_subprojects) | 
					
						
							|  |  |  |     @issues_by_priority = Issue.by_priority(@project, with_subprojects) | 
					
						
							|  |  |  |     @issues_by_category = Issue.by_category(@project, with_subprojects) | 
					
						
							|  |  |  |     @issues_by_assigned_to = Issue.by_assigned_to(@project, with_subprojects) | 
					
						
							|  |  |  |     @issues_by_author = Issue.by_author(@project, with_subprojects) | 
					
						
							| 
									
										
										
										
											2010-02-10 16:59:58 +00:00
										 |  |  |     @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 | 
					
						
							| 
									
										
										
										
											2018-10-03 07:16:47 +00:00
										 |  |  |     with_subprojects = Setting.display_subprojects_issues? | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |     case params[:detail] | 
					
						
							|  |  |  |     when "tracker" | 
					
						
							|  |  |  |       @field = "tracker_id" | 
					
						
							| 
									
										
										
										
											2020-11-16 14:21:25 +00:00
										 |  |  |       @rows = @project.rolled_up_trackers(with_subprojects).visible | 
					
						
							| 
									
										
										
										
											2018-10-03 07:16:47 +00:00
										 |  |  |       @data = Issue.by_tracker(@project, with_subprojects) | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							| 
									
										
										
										
											2021-12-12 04:40:32 +00:00
										 |  |  |       @rows = @project.shared_versions.sorted + [Version.new(:name => "[#{l(:label_none)}]")] | 
					
						
							| 
									
										
										
										
											2018-10-03 07:16:47 +00:00
										 |  |  |       @data = Issue.by_version(@project, with_subprojects) | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							| 
									
										
										
										
											2018-10-03 07:16:47 +00:00
										 |  |  |       @data = Issue.by_priority(@project, with_subprojects) | 
					
						
							| 
									
										
										
										
											2007-03-12 17:59:02 +00:00
										 |  |  |       @report_title = l(:field_priority) | 
					
						
							|  |  |  |     when "category" | 
					
						
							|  |  |  |       @field = "category_id" | 
					
						
							| 
									
										
										
										
											2021-12-12 04:40:32 +00:00
										 |  |  |       @rows = @project.issue_categories + [IssueCategory.new(:name => "[#{l(:label_none)}]")] | 
					
						
							| 
									
										
										
										
											2018-10-03 07:16:47 +00:00
										 |  |  |       @data = Issue.by_category(@project, with_subprojects) | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							| 
									
										
										
										
											2021-12-12 04:40:32 +00:00
										 |  |  |       @rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sorted + [User.new(:firstname => "[#{l(:label_none)}]")] | 
					
						
							| 
									
										
										
										
											2018-10-03 07:16:47 +00:00
										 |  |  |       @data = Issue.by_assigned_to(@project, with_subprojects) | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							| 
									
										
										
										
											2018-12-02 22:31:44 +00:00
										 |  |  |       @rows = @project.users.sorted | 
					
						
							| 
									
										
										
										
											2018-10-03 07:16:47 +00:00
										 |  |  |       @data = Issue.by_author(@project, with_subprojects) | 
					
						
							| 
									
										
										
										
											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) | 
					
						
							| 
									
										
										
										
											2016-07-19 20:06:01 +00:00
										 |  |  |     else | 
					
						
							|  |  |  |       render_404 | 
					
						
							| 
									
										
										
										
											2010-02-09 16:47:27 +00:00
										 |  |  |     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 | 
					
						
							| 
									
										
										
										
											2017-12-19 10:15:22 +00:00
										 |  |  |     @statuses = @project.rolled_up_statuses.sorted.to_a | 
					
						
							| 
									
										
										
										
											2010-02-11 16:42:52 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2006-06-28 18:11:03 +00:00
										 |  |  | end |