|
|
|
@ -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)})") |
|
|
|
|
|
|
|
|
|