overwrite more mapping, as keeping the datatypes in excel is nice

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1681 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
t.felgentreff 14 years ago
parent 403b0bea58
commit 4d123d3f18
  1. 9
      lib/xls_report/cost_reports_controller_patch.rb

@ -33,6 +33,8 @@ if require_dependency 'cost_reports_controller'
# Overwrite a few mappings.
def field_representation_map(key, value)
case key.to_sym
when :units then value.to_i
when :spent_on then value.to_date
when :activity_id then mapped value, Enumeration, l(:caption_material_costs)
when :project_id then (l(:label_none) if value.to_i == 0) or Project.find(value.to_i).name
when :user_id, :assigned_to_id then (l(:label_none) if value.to_i == 0) or User.find(value.to_i).name
@ -44,6 +46,13 @@ if require_dependency 'cost_reports_controller'
end
end
def show_result(row, unit_id = @unit_id)
case unit_id
when 0 then row.real_costs ? row.real_costs : '-'
else row.units
end
end
# Build an xls file from a cost report.
def report_to_xls
find_optional_project

Loading…
Cancel
Save