summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-07-21 04:13:37 +0000
committerGo MAEDA <maeda@farend.jp>2022-07-21 04:13:37 +0000
commit0c037a7b48e061fa32e96c21718b30560431c4c7 (patch)
treefeba0bcd09960e044151cdafd0b69f740b098918 /app/helpers
parentcfbc2e7a33cb068f1dd71b06a2625ebeecd56ccb (diff)
downloadredmine-0c037a7b48e061fa32e96c21718b30560431c4c7.tar.gz
redmine-0c037a7b48e061fa32e96c21718b30560431c4c7.zip
CSV export of issues report (#37362).
Patch by Mizuki ISHIKAWA. git-svn-id: https://svn.redmine.org/redmine/trunk@21732 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/reports_helper.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb
index a01abf3a3..36ee6ddce 100644
--- a/app/helpers/reports_helper.rb
+++ b/app/helpers/reports_helper.rb
@@ -44,4 +44,22 @@ module ReportsHelper
parameters = {:set_filter => 1, :subproject_id => '!*', field => (row.id || '!*')}.merge(options)
project_issues_path(row.is_a?(Project) ? row : project, parameters)
end
+
+ def issue_report_details_to_csv(field_name, statuses, rows, data)
+ Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv|
+ # csv headers
+ headers = [''] + statuses.map(&:name) + [l(:label_open_issues_plural), l(:label_closed_issues_plural), l(:label_total)]
+ csv << headers
+
+ # csv lines
+ rows.each do |row|
+ csv <<
+ [row.name] +
+ statuses.map{|s| aggregate(data, { field_name => row.id, 'status_id' => s.id })} +
+ [aggregate(data, { field_name => row.id, 'closed' => 0 })] +
+ [aggregate(data, { field_name => row.id, 'closed' => 1 })] +
+ [aggregate(data, { field_name => row.id })]
+ end
+ end
+ end
end