split the field mapping to be able to hook into it

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1679 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
t.felgentreff 14 years ago
parent db71a96d7e
commit af01f503e4
  1. 15
      lib/xls_report/cost_reports_controller_patch.rb

@ -30,13 +30,26 @@ if require_dependency 'cost_reports_controller'
end
end
# Overwrite a few mappings.
def field_representation_map(key, value)
case key.to_sym
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
when :issue_id
return l(:label_none) if value.to_i == 0
issue = Issue.find(value.to_i)
"#{issue.project + " - " if @project}#{issue.tracker} ##{issue.id}: #{issue.subject}"
else super(key, value)
end
end
# Build an xls file from a cost report.
def report_to_xls
find_optional_project
generate_query
set_cost_type
debugger
sb = SpreadsheetBuilder.new
sb.add_title("#{@project.name + " >> " if @project}#{l(:cost_reports_title)} (#{format_date(Date.today)})")

Loading…
Cancel
Save