remove obsolete code

pull/6827/head
Tim Felgentreff 13 years ago
parent 1d81ae4028
commit fb14a2d30a
  1. 109
      app/controllers/cost_reports_controller.rb

@ -61,25 +61,6 @@ class CostReportsController < ApplicationController
end
end
# def index
# @valid = valid_query?
# if @valid
# if @query.group_bys.empty?
# @table_partial = "cost_entry_table"
# elsif @query.depth_of(:column) + @query.depth_of(:row) == 1
# @table_partial = "simple_cost_report_table"
# else
# if @query.depth_of(:column) == 0 || @query.depth_of(:row) == 0
# @query.depth_of(:column) == 0 ? @query.column(:singleton_value) : @query.row(:singleton_value)
# end
# @table_partial = "cost_report_table"
# end
# end
# respond_to do |format|
# format.html { render :layout => !request.xhr? }
# end
# end
##
# @Override
# Use respond_to hook, so redmine_export can hook up the excel exporting
@ -97,62 +78,12 @@ class CostReportsController < ApplicationController
redirect_to :action => :index
end
# def available_values
# filter = filter_class(params[:filter_name].to_s)
# render_404 unless filter
# can_answer = filter.respond_to? :available_values
# @available_values = filter.available_values
# respond_to do |format|
# format.html { can_answer ? render(:layout => !request.xhr?) : "" }
# end
# end
##
# Determines if the request contains filters to set
# def set_filter? #FIXME: rename to set_query?
# params[:set_filter].to_i == 1
# end
##
# Determines if the request sets a unit type
def set_unit?
params[:unit]
end
##
# Find a query to search on and put it in the session
# def filter_params
# filters = http_filter_parameters if set_filter?
# filters ||= session[:report].try(:[], :filters)
# filters ||= default_filter_parameters
# end
# def group_params
# groups = http_group_parameters if set_filter?
# groups ||= session[:report].try(:[], :groups)
# groups ||= default_group_parameters
# end
# ##
# # Extract active filters from the http params
# def http_filter_parameters
# params[:fields] ||= []
# (params[:fields].reject { |f| f.empty? } || []).inject({:operators => {}, :values => {}}) do |hash, field|
# hash[:operators][field.to_sym] = params[:operators][field]
# hash[:values][field.to_sym] = params[:values][field]
# hash
# end
# end
# def http_group_parameters
# if params[:groups]
# rows = params[:groups][:rows]
# columns = params[:groups][:columns]
# end
# {:rows => (rows || []), :columns => (columns || [])}
# end
##
# @Override
# We cannot show a progressbar in Redmine, due to Prototype being less than 1.7
@ -185,10 +116,6 @@ class CostReportsController < ApplicationController
end
end
# def force_default?
# params[:default].to_i == 1
# end
##
# We apply a project filter, except when we are just applying a brand new query
def ensure_project_scope!(filters)
@ -206,42 +133,6 @@ class CostReportsController < ApplicationController
!(set_filter? or set_unit?)
end
##
# Build the query from the current request and save it to
# the session.
# def generate_query
# CostQuery::QueryUtils.cache.clear
# filters = force_default? ? default_filter_parameters : filter_params
# groups = force_default? ? default_group_parameters : group_params
# ensure_project_scope! filters
# session[:report] = {:filters => filters, :groups => groups}
# @query = CostQuery.new
# @query.tap do |q|
# filters[:operators].each do |filter, operator|
# q.filter(filter.to_sym,
# :operator => operator,
# :values => filters[:values][filter])
# end
# end
# groups[:rows].reverse_each {|r| @query.row(r) }
# groups[:columns].reverse_each {|c| @query.column(c) }
# @query
# end
def valid_query?
return true unless @query
erroneous = @query.filters ? @query.filters.select { |f| !f.valid? } : []
@custom_errors = erroneous.map do |err|
filterlabel = "Filter #{l(err.label)}: "
errorstr = ''
err.errors.each_key do |key|
errorstr << "'#{err.errors[key].join(', ')}' #{l(("validation_failure_" + key.to_s).to_sym)}"
end
filterlabel + errorstr
end
erroneous.empty?
end
##
# Determine active cost types, the currently selected unit and corresponding cost type
def set_cost_types

Loading…
Cancel
Save