|
|
|
@ -36,8 +36,28 @@ module OpenProject::PdfExport::ExportCard |
|
|
|
|
def draw |
|
|
|
|
# Get value from model |
|
|
|
|
if @work_package.respond_to?(@property_name) |
|
|
|
|
value = @work_package.send(@property_name) |
|
|
|
|
value = extract_property |
|
|
|
|
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 |
|
|
|
|
value = "" |
|
|
|
|
available_languages.each do |locale| |
|
|
|
@ -49,14 +69,10 @@ module OpenProject::PdfExport::ExportCard |
|
|
|
|
end |
|
|
|
|
@localised_custom_field_name = @custom_field.name if !!@custom_field |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
draw_value(value) |
|
|
|
|
value |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def available_languages |
|
|
|
|
Setting.available_languages |
|
|
|
|
end |
|
|
|
|