GitLab steht Mittwoch, den 23. September, zwischen 10:00 und 12:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 7e4650ef authored by jplang's avatar jplang

Fixed: PDF export of a issue list grouped by a custom field raises an error (#4600).

git-svn-id: https://svn.redmine.org/redmine/trunk@3333 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent cfeb402f
......@@ -40,6 +40,7 @@ class IssuesController < ApplicationController
helper :attachments
include AttachmentsHelper
helper :queries
include QueriesHelper
helper :sort
include SortHelper
include IssuesHelper
......
......@@ -144,13 +144,15 @@ module Redmine
# rows
pdf.SetFontStyle('',8)
pdf.SetFillColor(255, 255, 255)
group = false
previous_group = false
issues.each do |issue|
if query.grouped? && issue.send(query.group_by) != group
group = issue.send(query.group_by)
if query.grouped? && (group = query.group_by_column.value(issue)) != previous_group
pdf.SetFontStyle('B',9)
pdf.Cell(277, row_height, "#{group.blank? ? 'None' : group.to_s}", 1, 1, 'L')
pdf.Cell(277, row_height,
(group.blank? ? 'None' : group.to_s) + " (#{@issue_count_by_group[group]})",
1, 1, 'L')
pdf.SetFontStyle('',8)
previous_group = group
end
pdf.Cell(15, row_height, issue.id.to_s, 1, 0, 'L', 1)
query.columns.each_with_index do |column, i|
......
......@@ -236,6 +236,14 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'application/pdf', @response.content_type
end
def test_index_pdf_with_query_grouped_by_list_custom_field
get :index, :project_id => 1, :query_id => 9, :format => 'pdf'
assert_response :success
assert_not_nil assigns(:issues)
assert_not_nil assigns(:issue_count_by_group)
assert_equal 'application/pdf', @response.content_type
end
def test_index_sort
get :index, :sort => 'tracker,id:desc'
assert_response :success
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment