##// END OF EJS Templates
Omit subtasks/related issues sections when empty on PDF export (#5634)....
Jean-Philippe Lang -
r7725:886310055bd1
parent child
Show More
@@ -362,48 +362,53 module Redmine
362 Redmine::WikiFormatting.to_html(
362 Redmine::WikiFormatting.to_html(
363 Setting.text_formatting, issue.description.to_s),"LRB")
363 Setting.text_formatting, issue.description.to_s),"LRB")
364
364
365 # for CJK
365 unless issue.leaf?
366 truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 90 : 65 )
366 # for CJK
367
367 truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 90 : 65 )
368 pdf.SetFontStyle('B',9)
368
369 pdf.RDMCell(35+155,5, l(:label_subtask_plural) + ":", "LTR")
369 pdf.SetFontStyle('B',9)
370 pdf.Ln
370 pdf.RDMCell(35+155,5, l(:label_subtask_plural) + ":", "LTR")
371 issue_list(issue.descendants.sort_by(&:lft)) do |child, level|
372 buf = truncate("#{child.tracker} # #{child.id}: #{child.subject}",
373 :length => truncate_length)
374 level = 10 if level >= 10
375 pdf.SetFontStyle('',8)
376 pdf.RDMCell(35+135,5, (level >=1 ? " " * level : "") + buf, "L")
377 pdf.SetFontStyle('B',8)
378 pdf.RDMCell(20,5, child.status.to_s, "R")
379 pdf.Ln
371 pdf.Ln
372 issue_list(issue.descendants.sort_by(&:lft)) do |child, level|
373 buf = truncate("#{child.tracker} # #{child.id}: #{child.subject}",
374 :length => truncate_length)
375 level = 10 if level >= 10
376 pdf.SetFontStyle('',8)
377 pdf.RDMCell(35+135,5, (level >=1 ? " " * level : "") + buf, "L")
378 pdf.SetFontStyle('B',8)
379 pdf.RDMCell(20,5, child.status.to_s, "R")
380 pdf.Ln
381 end
380 end
382 end
381 pdf.SetFontStyle('B',9)
382 pdf.RDMCell(35+155,5, l(:label_related_issues) + ":", "LTR")
383 pdf.Ln
384
383
385 # for CJK
384 relations = issue.relations.select { |r| r.other_issue(issue).visible? }
386 truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 80 : 60 )
385 unless relations.empty?
387
386 # for CJK
388 issue.relations.select { |r| r.other_issue(issue).visible? }.each do |relation|
387 truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 80 : 60 )
389 buf = ""
388
390 buf += "#{l(relation.label_for(issue))} "
389 pdf.SetFontStyle('B',9)
391 if relation.delay && relation.delay != 0
390 pdf.RDMCell(35+155,5, l(:label_related_issues) + ":", "LTR")
392 buf += "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)}) "
393 end
394 if Setting.cross_project_issue_relations?
395 buf += "#{relation.other_issue(issue).project} - "
396 end
397 buf += "#{relation.other_issue(issue).tracker}" +
398 " # #{relation.other_issue(issue).id}: #{relation.other_issue(issue).subject}"
399 buf = truncate(buf, :length => truncate_length)
400 pdf.SetFontStyle('', 8)
401 pdf.RDMCell(35+155-50,5, buf, "L")
402 pdf.SetFontStyle('B',8)
403 pdf.RDMCell(10,5, relation.other_issue(issue).status.to_s, "")
404 pdf.RDMCell(20,5, format_date(relation.other_issue(issue).start_date), "")
405 pdf.RDMCell(20,5, format_date(relation.other_issue(issue).due_date), "R")
406 pdf.Ln
391 pdf.Ln
392 relations.each do |relation|
393 buf = ""
394 buf += "#{l(relation.label_for(issue))} "
395 if relation.delay && relation.delay != 0
396 buf += "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)}) "
397 end
398 if Setting.cross_project_issue_relations?
399 buf += "#{relation.other_issue(issue).project} - "
400 end
401 buf += "#{relation.other_issue(issue).tracker}" +
402 " # #{relation.other_issue(issue).id}: #{relation.other_issue(issue).subject}"
403 buf = truncate(buf, :length => truncate_length)
404 pdf.SetFontStyle('', 8)
405 pdf.RDMCell(35+155-50,5, buf, "L")
406 pdf.SetFontStyle('B',8)
407 pdf.RDMCell(10,5, relation.other_issue(issue).status.to_s, "")
408 pdf.RDMCell(20,5, format_date(relation.other_issue(issue).start_date), "")
409 pdf.RDMCell(20,5, format_date(relation.other_issue(issue).due_date), "R")
410 pdf.Ln
411 end
407 end
412 end
408 pdf.RDMCell(190,5, "", "T")
413 pdf.RDMCell(190,5, "", "T")
409 pdf.Ln
414 pdf.Ln
General Comments 0
You need to be logged in to leave comments. Login now