From a47979bcc2888c556a016847ee170e1da1fdea05 Mon Sep 17 00:00:00 2001 From: Etienne Massip Date: Wed, 26 Oct 2011 17:00:16 +0000 Subject: [PATCH] Reverted removal of project assignment to query (#9108). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7656 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/queries_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index 0e82eb631..862bc71b6 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -71,6 +71,7 @@ module QueriesHelper cond << " OR project_id = #{@project.id}" if @project @query = Query.find(params[:query_id], :conditions => cond) raise ::Unauthorized unless @query.visible? + @query.project = @project session[:query] = {:id => @query.id, :project_id => @query.project_id} sort_clear elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) @@ -82,10 +83,10 @@ module QueriesHelper else # retrieve from session @query = Query.find_by_id(session[:query][:id]) if session[:query][:id] - @query ||= Query.new(:name => "_", :project_id => session[:project_id] || @project, :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names]) + @query ||= Query.new(:name => "_", :project => @project, :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names]) end end - + def build_query_from_params if params[:fields] || params[:f] @query.filters = {}