Skip to content
Snippets Groups Projects
Commit c742d25a authored by minsoc's avatar minsoc
Browse files

hotline #80939 records search selection now correctly check default page size...

hotline #80939 records search selection now correctly check default page size in search module parameters
parent b1f52693
Branches
Tags
3 merge requests!2870Hotline,!2869Master,!2859hotline #80939 records search selection now correctly check default page size in…
Pipeline #5145 failed with stage
in 2 minutes and 24 seconds
- ticket #80939 : la sélection multiple de notices par page prend correctement en compte la taille de page par défaut définie dans les options du résultat de recherche
\ No newline at end of file
...@@ -473,6 +473,7 @@ class Class_MoteurRecherche { ...@@ -473,6 +473,7 @@ class Class_MoteurRecherche {
public function lancerRecherche($criteres_recherche) { public function lancerRecherche($criteres_recherche) {
xdebug_break();
$this->visitSearchSettings($criteres_recherche); $this->visitSearchSettings($criteres_recherche);
$search_result = new Class_MoteurRecherche_Result($this, $criteres_recherche); $search_result = new Class_MoteurRecherche_Result($this, $criteres_recherche);
......
...@@ -21,9 +21,14 @@ ...@@ -21,9 +21,14 @@
class ZendAfi_Controller_Action_Helper_SearchRecords extends Zend_Controller_Action_Helper_Abstract { class ZendAfi_Controller_Action_Helper_SearchRecords extends Zend_Controller_Action_Helper_Abstract {
public function searchRecords() { public function searchRecords($preferences = []) {
$criteria = (new Class_CriteresRecherche()) $criteria = (new Class_CriteresRecherche())->setParams($this->getRequest()->getParams());
->setParams($this->getRequest()->getParams());
$preferences = Class_Profil::getCurrentProfil()
->getCfgModulesPreferences('recherche', 'resultat', 'simple');
if (isset($preferences['liste_nb_par_page']))
$criteria->setDefaultPageSize($preferences['liste_nb_par_page']);
return Class_MoteurRecherche::getInstance() return Class_MoteurRecherche::getInstance()
->lancerRecherche($criteria); ->lancerRecherche($criteria);
......
...@@ -292,16 +292,26 @@ class SearchSelectionSelectClearTest extends SearchSelectionTestCase { ...@@ -292,16 +292,26 @@ class SearchSelectionSelectClearTest extends SearchSelectionTestCase {
class SearchSelectionSelectPageTest extends SearchSelectionTestCase { class SearchSelectionSelectPageTest extends SearchSelectionTestCase {
public function setUp() { /** @test */
parent::setUp(); public function withTwoRecordsInSessionAndPageSizeTwoSelectShouldAddRecordNine() {
Zend_Registry::get('session')->search_record_selection = [8, 10]; Zend_Registry::get('session')->search_record_selection = [8, 10];
$this->dispatch('/records/select-page/expressionRecherche/pomme/facettes/T3/page/1/page_size/2', true); $this->dispatch('/records/select-page/expressionRecherche/pomme/facettes/T3/page/1/page_size/2', true);
$this->assertEquals([8, 10, 9],
Zend_Registry::get('session')->search_record_selection);
return $this->_response->getBody();
} }
/** @test */ /** @test */
public function sessionShouldContainsNine() { public function withEmptySessionAndDefaultPageSizeTwoSelectShouldAddEightAndNine() {
$this->assertEquals([8, 10, 9], Zend_Registry::get('session')->search_record_selection = [];
Class_Profil::getCurrentProfil()->setCfgModulesPreferences(['liste_nb_par_page' => 2],
'recherche',
'resultat',
'simple');
$this->dispatch('/records/select-page/expressionRecherche/pomme/facettes/T3/page/1', true);
$this->assertEquals([8, 9],
Zend_Registry::get('session')->search_record_selection); Zend_Registry::get('session')->search_record_selection);
return $this->_response->getBody(); return $this->_response->getBody();
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment