Fixed that issue list PDF export displays ID column twice (#13630).

Contributed by F Schroedter.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11693 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Etienne Massip 2013-04-02 17:34:15 +00:00
parent ed5b14884c
commit 4a3864a180
1 changed files with 14 additions and 17 deletions

View File

@ -380,7 +380,7 @@ module Redmine
col_width
end
def render_table_header(pdf, query, col_width, row_height, col_id_width, table_width)
def render_table_header(pdf, query, col_width, row_height, table_width)
# headers
pdf.SetFontStyle('B',8)
pdf.SetFillColor(230, 230, 230)
@ -389,13 +389,12 @@ module Redmine
base_x = pdf.GetX
base_y = pdf.GetY
max_height = issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true)
pdf.Rect(base_x, base_y, table_width + col_id_width, max_height, 'FD');
pdf.Rect(base_x, base_y, table_width, max_height, 'FD');
pdf.SetXY(base_x, base_y);
# write the cells on page
pdf.RDMCell(col_id_width, row_height, "#", "T", 0, 'C', 1)
issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true)
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_width)
pdf.SetY(base_y + max_height);
# rows
@ -417,22 +416,22 @@ module Redmine
# Landscape A4 = 210 x 297 mm
page_height = 210
page_width = 297
left_margin = 10
right_margin = 10
bottom_margin = 20
col_id_width = 10
row_height = 4
# column widths
table_width = page_width - right_margin - 10 # fixed left margin
table_width = page_width - right_margin - left_margin
col_width = []
unless query.inline_columns.empty?
col_width = calc_col_width(issues, query, table_width - col_id_width, pdf)
col_width = calc_col_width(issues, query, table_width, pdf)
table_width = col_width.inject(0) {|s,v| s += v}
end
# use full width if the description is displayed
# use full width if the description is displayed
if table_width > 0 && query.has_column?(:description)
col_width = col_width.map {|w| w = w * (page_width - right_margin - 10 - col_id_width) / table_width}
col_width = col_width.map {|w| w * (page_width - right_margin - left_margin) / table_width}
table_width = col_width.inject(0) {|s,v| s += v}
end
@ -440,7 +439,7 @@ module Redmine
pdf.SetFontStyle('B',11)
pdf.RDMCell(190,10, title)
pdf.Ln
render_table_header(pdf, query, col_width, row_height, col_id_width, table_width)
render_table_header(pdf, query, col_width, row_height, table_width)
previous_group = false
issue_list(issues) do |issue, level|
if query.grouped? &&
@ -449,7 +448,7 @@ module Redmine
group_label = group.blank? ? 'None' : group.to_s.dup
group_label << " (#{query.issue_count_by_group[group]})"
pdf.Bookmark group_label, 0, -1
pdf.RDMCell(table_width + col_id_width, row_height * 2, group_label, 1, 1, 'L')
pdf.RDMCell(table_width, row_height * 2, group_label, 1, 1, 'L')
pdf.SetFontStyle('',8)
previous_group = group
end
@ -468,15 +467,14 @@ module Redmine
space_left = page_height - base_y - bottom_margin
if max_height > space_left
pdf.AddPage("L")
render_table_header(pdf, query, col_width, row_height, col_id_width, table_width)
render_table_header(pdf, query, col_width, row_height, table_width)
base_x = pdf.GetX
base_y = pdf.GetY
end
# write the cells on page
pdf.RDMCell(col_id_width, row_height, issue.id.to_s, "T", 0, 'C', 1)
issues_to_pdf_write_cells(pdf, col_values, col_width, row_height)
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_width)
pdf.SetY(base_y + max_height);
if query.has_column?(:description) && issue.description?
@ -513,9 +511,8 @@ module Redmine
end
# Draw lines to close the row (MultiCell border drawing in not uniform)
def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y,
id_width, col_widths)
col_x = top_x + id_width
def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y, col_widths)
col_x = top_x
pdf.Line(col_x, top_y, col_x, lower_y) # id right border
col_widths.each do |width|
col_x += width