[28315] Only attach attachments to PDF if any exists

If the work package has attachments that are not exportable, the empty
table cell would result in an  error otherwise

https://community.openproject.com/wp/28315

[ci skip]
pull/6537/head
Oliver Günther 6 years ago
parent cc24e2912b
commit 78f3908ae4
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 2
      app/assets/stylesheets/content/_action_menu_main.sass
  2. 4
      app/assets/stylesheets/content/_modal.sass
  3. 2
      app/models/work_package/pdf_export/work_package_list_to_pdf.rb

@ -30,7 +30,7 @@
ul
list-style-type: none
margin: 0
width: 230px
width: 240px
border: 1px solid #dddddd
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.15)
padding: 3px 0

@ -150,12 +150,14 @@ ul.export-options
margin: 0 0 30px 0
text-align: center
display: inline-block
min-width: 32%
width: 32%
a
cursor: pointer
text-decoration: none
color: $body-font-color
font-weight: normal
overflow-wrap: break-word
word-wrap: break-word
&:hover, &:active
text-decoration: none
color: $body-font-color

@ -151,10 +151,12 @@ class WorkPackage::PdfExport::WorkPackageListToPdf < WorkPackage::Exporter::Base
if options[:show_attachments] && work_package.attachments.exists?
attachments = make_attachments_cells(work_package.attachments)
if attachments.any?
result << [
{ content: pdf.make_table([attachments]), colspan: description_colspan }
]
end
end
if query.grouped? && (group = query.group_by_column.value(work_package)) != previous_group
label = make_group_label(group)

Loading…
Cancel
Save