diff --git a/library/ZendAfi/Controller/Action/Helper/SitothequeListViewMode.php b/library/ZendAfi/Controller/Action/Helper/SitothequeListViewMode.php index dc3e105de9f9e633d71ae878cfe6835e874dd0ad..5dbb6e517b30827157f02c1214bf3d6e89e11005 100644 --- a/library/ZendAfi/Controller/Action/Helper/SitothequeListViewMode.php +++ b/library/ZendAfi/Controller/Action/Helper/SitothequeListViewMode.php @@ -78,6 +78,12 @@ class ZendAfi_Controller_Action_Helper_SitothequeListViewMode extends ZendAfi_Co } + + public function getSearchUrl() { + return parent::getSearchUrl() + ['start_cat' => $this->getRequestParam('start_cat')]; + } + + protected function getSearchParams() { $search_params = ['where' => 'titre like \'%' . trim($this->getSearch()) . '%\'', 'order' => 'titre']; diff --git a/library/ZendAfi/View/Helper/Admin/ListViewMode.php b/library/ZendAfi/View/Helper/Admin/ListViewMode.php index b8a5e1d287822245dd9fb35ca13feceda892dde0..364668f1d3c6d705c4852da33080c89785be385c 100644 --- a/library/ZendAfi/View/Helper/Admin/ListViewMode.php +++ b/library/ZendAfi/View/Helper/Admin/ListViewMode.php @@ -42,9 +42,6 @@ class ZendAfi_View_Helper_Admin_ListViewMode extends ZendAfi_View_Helper_BaseHel if (!$this->_list->isSearchEnabled()) return ''; - $url = $this->view->url($this->_list->getSearchUrl(), null, true); - $submit = "$('#list_search_form').submit(function(event) {event.preventDefault(); event.stopImmediatePropagation(); var search = $('#list_title_search').val();var url = '". $url ."' + search; document.location.href = url;});"; - $search_input = $this->_tag('input', '', ['type' => 'text', 'name' => 'title_search', @@ -52,13 +49,14 @@ class ZendAfi_View_Helper_Admin_ListViewMode extends ZendAfi_View_Helper_BaseHel 'placeholder' => $this->_('titre du document'), 'value' => $this->_list->getSearchValue()]); - Class_ScriptLoader::getInstance()->addJQueryReady($submit); - $search_button = $this->_tag('button', $this->_('Filtrer'), ['id' => 'list_filter_button']); return $this->_tag('form', $search_input . $search_button, ['style' => 'text-align: right;', + 'action' => $this->view->url(array_filter($this->_list->getSearchUrl()), + null, + true), 'id' => 'list_search_form']); } diff --git a/tests/application/modules/opac/controllers/SitoControllerTest.php b/tests/application/modules/opac/controllers/SitoControllerTest.php index 04b3be18fbfa72ee2edebc3f99104d3c5440b201..3bda4499b925c9a7fe75bf0ea94fd1749012a183 100644 --- a/tests/application/modules/opac/controllers/SitoControllerTest.php +++ b/tests/application/modules/opac/controllers/SitoControllerTest.php @@ -59,6 +59,7 @@ abstract class SitoControllerTestCase extends AbstractControllerTestCase { + abstract class SitoControllerViewCategoyTestCase extends SitoControllerTestCase { public function setUp() { parent::setUp(); @@ -195,6 +196,13 @@ class SitoControllerViewCategorySearchTest extends SitoControllerViewCategoyTest $this->assertNotXPath('//div[@class="sitotheque"]//a[@href="http://linuxfr.org"]', $this->_response->getBody()); } + + + /** @test */ + public function formTitleSearchShouldContainsStartCat() { + $this->assertXPath('//form[@id="list_search_form"][@action="/sito/viewcategory/start_cat/12"]', + $this->_response->getBody()); + } }