Get array of workpackage children

pull/6827/head
Oliver Günther 8 years ago
parent bdc3c5c636
commit 99b03cc31d
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 28
      lib/open_project/pdf_export/export_card/column_element.rb

@ -36,8 +36,28 @@ module OpenProject::PdfExport::ExportCard
def draw def draw
# Get value from model # Get value from model
if @work_package.respond_to?(@property_name) if @work_package.respond_to?(@property_name)
value = @work_package.send(@property_name) value = extract_property
else else
value = extract_custom_field
end
draw_value(value)
end
private
def extract_property
value = @work_package.send(@property_name)
case @property_name.to_s
when 'children'
return value.to_a
end
value
end
def extract_custom_field
# Look in Custom Fields # Look in Custom Fields
value = "" value = ""
available_languages.each do |locale| available_languages.each do |locale|
@ -49,14 +69,10 @@ module OpenProject::PdfExport::ExportCard
end end
@localised_custom_field_name = @custom_field.name if !!@custom_field @localised_custom_field_name = @custom_field.name if !!@custom_field
end end
end
draw_value(value) value
end end
private
def available_languages def available_languages
Setting.available_languages Setting.available_languages
end end

Loading…
Cancel
Save