+optional clause for #find_optional_report query

pull/6827/head
Markus Kahl 14 years ago
parent 93317925c1
commit 186fe3cbf2
  1. 6
      lib/report/controller.rb

@ -329,10 +329,12 @@ module Report::Controller
##
# Find a report if :id was passed as parameter.
# Raises RecordNotFound if an invalid :id was passed.
def find_optional_report
#
# @param query An optional query added to the disjunction qualifiying reports to be returned.
def find_optional_report(query="1=0")
if params[:id]
@query = report_engine.find(params[:id].to_i,
:conditions => ["#{is_public_sql} OR (#{user_key} = ?)", current_user.id])
:conditions => ["#{is_public_sql} OR (#{user_key} = ?) OR (#{query})", current_user.id])
@query.deserialize if @query
end
rescue ActiveRecord::RecordNotFound

Loading…
Cancel
Save