]> source.dussan.org Git - redmine.git/commitdiff
Reverted removal of project assignment to query (#9108).
authorEtienne Massip <etienne.massip@gmail.com>
Wed, 26 Oct 2011 17:00:16 +0000 (17:00 +0000)
committerEtienne Massip <etienne.massip@gmail.com>
Wed, 26 Oct 2011 17:00:16 +0000 (17:00 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7656 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/queries_helper.rb

index 0e82eb6312654a69c87db0174851a773812d51e4..862bc71b68b5472b86da29402c4bf171ac130453 100644 (file)
@@ -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 = {}