From b3c5ded2d59da29030baf2078c6efb85fb42b5a3 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 17 Jul 2012 14:34:40 -0400
Subject: [PATCH] Make sure search classes are sent all relevant parameters
 from controllers.

---
 .../src/VuFind/Controller/AbstractSearch.php      | 13 +++++++++++--
 .../VuFind/Controller/MyResearchController.php    | 15 +++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php
index 09b56b0b207..34fb731493b 100644
--- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php
+++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php
@@ -27,7 +27,8 @@
  */
 namespace VuFind\Controller;
 use VuFind\Search\Memory,
-    VuFind\Search\Options as SearchOptions, VuFind\Search\ResultScroller;
+    VuFind\Search\Options as SearchOptions, VuFind\Search\ResultScroller,
+    Zend\Stdlib\Parameters;
 
 /**
  * VuFind Search Controller
@@ -111,7 +112,15 @@ class AbstractSearch extends AbstractBase
         $paramsClass = $this->getParamsClass();
         $params = new $paramsClass();
         $params->recommendationsEnabled(true);
-        $params->initFromRequest($this->getRequest()->getQuery());
+
+        // Send both GET and POST variables to search class:
+        $params->initFromRequest(
+            new Parameters(
+                $this->getRequest()->getQuery()->toArray()
+                + $this->getRequest()->getPost()->toArray()
+            )
+        );
+
         // Attempt to perform the search; if there is a problem, inspect any Solr
         // exceptions to see if we should communicate to the user about them.
         try {
diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php
index 3a6a350f00a..883c8898a45 100644
--- a/module/VuFind/src/VuFind/Controller/MyResearchController.php
+++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php
@@ -28,7 +28,8 @@
 namespace VuFind\Controller;
 
 use VuFind\Config\Reader as ConfigReader, VuFind\Exception\Auth as AuthException,
-    VuFind\Exception\ListPermission as ListPermissionException;
+    VuFind\Exception\ListPermission as ListPermissionException,
+    Zend\Stdlib\Parameters;
 
 /**
  * Controller for the user account area.
@@ -516,7 +517,17 @@ class MyResearchController extends AbstractBase
         try {
             $params = new \VuFind\Search\Favorites\Params();
             $params->setAuthManager($this->getAuthManager());
-            $params->initFromRequest($this->getRequest()->getQuery());
+
+            // We want to merge together GET, POST and route parameters to
+            // initialize our search object:
+            $params->initFromRequest(
+                new Parameters(
+                    $this->getRequest()->getQuery()->toArray()
+                    + $this->getRequest()->getPost()->toArray()
+                    + array('id' => $this->params()->fromRoute('id'))
+                )
+            );
+
             $results = new \VuFind\Search\Favorites\Results($params);
             $results->performAndProcessSearch();
             return $this->createViewModel(array('results' => $results));
-- 
GitLab