pull/6827/head
jwollert 14 years ago
commit 1ea0751fc1
  1. 20
      app/controllers/cost_reports_controller.rb
  2. 5
      app/helpers/reporting_helper.rb
  3. 2
      app/models/cost_query/custom_field_mixin.rb
  4. 5
      app/models/cost_query/query_utils.rb

@ -6,9 +6,23 @@ class CostReportsController < ApplicationController
rescue_from Exception do |exception|
session.delete(:report)
@custom_errors ||= []
@custom_errors << l(:error_generic)
render :layout => !request.xhr?
if Rails.env == "production"
@custom_errors ||= []
@custom_errors << l(:error_generic)
render :layout => !request.xhr?
logger.fatal <<-THE_ERROR
==============================================================================
REPORTING ERROR:
#{exception.class}: #{exception.message}
#{exception.backtrace.join("\n ")}
==============================================================================
THE_ERROR
else
raise exception
end
end
helper :reporting

@ -1,11 +1,6 @@
module ReportingHelper
include QueriesHelper
def l(*values)
return values.first if values.size == 1 and values.first.respond_to? :to_str
super
end
##
# For a given CostQuery::Filter filter, return an array of hashes, that contain
# the partials that should be rendered (:name) for that filter and necessary

@ -1,5 +1,5 @@
module CostQuery::CustomFieldMixin
include CostQuery::QueryUtils
include Report::QueryUtils
attr_reader :custom_field
SQL_TYPES = {

@ -14,6 +14,11 @@ module CostQuery::QueryUtils
end
end
def l(*values)
return values.first if values.size == 1 and values.first.respond_to? :to_str
I18n.t(*values)
end
def user_name(id)
# we have no identity map... :(
cache[:user_name][id] ||= User.find(id).name

Loading…
Cancel
Save