diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb index 5639b66..3adc88c 100644 --- a/lib/redmine/export/pdf.rb +++ b/lib/redmine/export/pdf.rb @@ -193,8 +193,19 @@ module Redmine pdf.footer_date = format_date(Date.today) pdf.AddPage - pdf.SetFontStyle('B',11) - pdf.Cell(190,10, "#{issue.project} - #{issue.tracker} # #{issue.id}: #{issue.subject}") + i = 0 + pdf.SetFontStyle('',9) + issue.ancestors.each do |ancestor| + if i == 0 + pdf.MultiCell(190,5,(i>=1?" " * i + ">":"") + "#{ancestor.project} - #{ancestor.tracker} # #{ancestor.id}: #{ancestor.subject} (#{ancestor.status.to_s})", "0", 1 ) + else + pdf.MultiCell(190,5,(i>=1?" " * i + ">":"") + "#{ancestor.project} - #{ancestor.tracker} # #{ancestor.id}: #{ancestor.subject} (#{ancestor.status.to_s})", "0", 1 ) + end + i += 1 + end + + pdf.SetFontStyle('B',11) + pdf.Cell(190,10,(i>=1?" " * (i+1) + ">":"") + "#{issue.project} - #{issue.tracker} # #{issue.id}: #{issue.subject}") pdf.Ln y0 = pdf.GetY @@ -245,20 +256,66 @@ module Redmine pdf.SetFontStyle('',9) pdf.MultiCell(155,5, (show_value custom_value),"R") end - + pdf.SetFontStyle('B',9) pdf.Cell(35,5, l(:field_subject) + ":","LTB") pdf.SetFontStyle('',9) pdf.Cell(155,5, issue.subject,"RTB") - pdf.Ln - + pdf.Ln + pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_description) + ":") + y = pdf.GetY + x = pdf.GetX + pdf.Cell(35,5, l(:field_description) + ":","") pdf.SetFontStyle('',9) - pdf.MultiCell(155,5, issue.description,"BR") - - pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY) - pdf.Line(pdf.GetX, pdf.GetY, 170, pdf.GetY) + pdf.MultiCell(155,5, issue.description,"R") + pdf.Line(x,y,x,pdf.GetY) + + i = 0 + issue_list(issue.descendants.sort_by(&:lft)) do |child, level| + if i == 0 + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:label_subtask_plural) + ":", "LT") + pdf.SetFontStyle('', 9) + pdf.Cell(125,5,(level>=1?" " * level + ">":"") + "#{child.project} - #{child.tracker} # #{child.id}: #{child.subject}".first(80)+"...", "T") + pdf.SetFontStyle('B',9) + pdf.Cell(30,5, "#{child.status.to_s}", "RT",0,"L",true) + pdf.Ln + else + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, "", "L") + pdf.SetFontStyle('', 9) + pdf.Cell(125,5,(level>=1?" " * level + ">":"") + "#{child.project} - #{child.tracker} # #{child.id}: #{child.subject}".first(80)+"...", "0") + pdf.SetFontStyle('B',9) + pdf.Cell(30,5, "#{child.status.to_s}", "R",0,"L",true) + pdf.Ln + end + i += 1 + end + + i = 0 + issue.relations.select { |r| r.other_issue(issue).visible? }.each do |relation| + if i == 0 + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(relation.label_for(issue)) + ":", "LT") + pdf.SetFontStyle('', 9) + pdf.Cell(125,5, "#{relation.other_issue(issue).project} - #{relation.other_issue(issue).tracker} # #{relation.other_issue(issue).id}: #{relation.other_issue(issue).subject}".first(80) + "...", "T") + pdf.SetFontStyle('B',9) + pdf.Cell(30,5, "#{relation.other_issue(issue).status.to_s}", "RT",0,"L",true) + pdf.Ln + else + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(relation.label_for(issue)) + ":", "L") + pdf.SetFontStyle('', 9) + pdf.Cell(125,5, "#{relation.other_issue(issue).project} - #{relation.other_issue(issue).tracker} # #{relation.other_issue(issue).id}: #{relation.other_issue(issue).subject}".first(80) + "...", "0") + pdf.SetFontStyle('B',9) + pdf.Cell(30,5, "#{relation.other_issue(issue).status.to_s}", "R",0,"L",true) + pdf.Ln + end + i += 1 + end + + pdf.Cell(190,5, "", "T",0) pdf.Ln if issue.changesets.any? && User.current.allowed_to?(:view_changesets, issue.project)