From 16735812bf243c313ea045ec9853ea84d2a79beb Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Fri, 23 Mar 2018 11:31:46 +0100
Subject: [PATCH] hotline #72890 fix rt comments + add test

---
 .../modules/opac/controllers/RechercheController.php      | 2 +-
 library/ZendAfi/Controller/Action/Helper/AddQuery.php     | 8 ++------
 library/ZendAfi/Controller/Plugin/Manager/Manager.php     | 2 +-
 .../modules/opac/controllers/RechercheControllerTest.php  | 6 ++++++
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/application/modules/opac/controllers/RechercheController.php b/application/modules/opac/controllers/RechercheController.php
index 5fc05521199..5c7b3423157 100644
--- a/application/modules/opac/controllers/RechercheController.php
+++ b/application/modules/opac/controllers/RechercheController.php
@@ -112,7 +112,7 @@ class RechercheController extends ZendAfi_Controller_Action {
         && !$criteres_recherche->ownedBy(Class_Users::getIdentity()))
       return $this->_redirect('opac/auth/login?redirect=' . urlencode(Class_Url::absolute($this->view->url())));
 
-    $this->_helper->addQuery($criteres_recherche->getCriteres());
+    $this->_helper->addQuery($this->view, $criteres_recherche->getCriteres());
 
     $this->_runSearchAndRender($criteres_recherche);
   }
diff --git a/library/ZendAfi/Controller/Action/Helper/AddQuery.php b/library/ZendAfi/Controller/Action/Helper/AddQuery.php
index 6a291d0e6e2..abf52755d86 100644
--- a/library/ZendAfi/Controller/Action/Helper/AddQuery.php
+++ b/library/ZendAfi/Controller/Action/Helper/AddQuery.php
@@ -22,16 +22,12 @@
 
 class ZendAfi_Controller_Action_Helper_AddQuery extends Zend_Controller_Action_Helper_Abstract {
 
-  public function direct(array $params = []) {
-    $action_controller = $this->getActionController();
-    $view = $action_controller->view;
-    $request = $action_controller->getRequest();
-
+  public function direct($view, array $params = []) {
     $this->getFrontController()
          ->getRouter()
          ->getCurrentRoute()
          ->match(str_replace(BASE_URL,
                              '',
-                             $view->url($params ? $params : $request->getQuery())));
+                             $view->url($params ? $params : $this->getRequest()->getQuery())));
   }
 }
\ No newline at end of file
diff --git a/library/ZendAfi/Controller/Plugin/Manager/Manager.php b/library/ZendAfi/Controller/Plugin/Manager/Manager.php
index 88f1a2ae4b6..f7ea6550a77 100644
--- a/library/ZendAfi/Controller/Plugin/Manager/Manager.php
+++ b/library/ZendAfi/Controller/Plugin/Manager/Manager.php
@@ -140,7 +140,7 @@ class ZendAfi_Controller_Plugin_Manager_Manager extends ZendAfi_Controller_Plugi
     if ($this->_response->isRedirect())
       return;
 
-    $this->_helper->addQuery();
+    $this->_helper->addQuery($this->_view);
 
     if (!$model = $this->_findModel()) {
       $this->_redirectToIndex();
diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php
index f71b3af9aa4..13cd4d2015e 100644
--- a/tests/application/modules/opac/controllers/RechercheControllerTest.php
+++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php
@@ -1234,6 +1234,12 @@ class RechercheAvanceeControllerSimpleActionWithDefaultConfigTest extends Recher
   }
 
 
+  /** @test */
+  public function pageShouldContainsRechTitresMaupassantWrappedInSlahes() {
+    $this->assertXPath('//a[contains(@href, "/rech_titres/maupassant")]');
+  }
+
+
   /** @test */
   public function userSettingBookmarkedDomainShouldBeOne() {
     $this->assertEquals(1,
-- 
GitLab