diff --git a/application/modules/opac/controllers/BibController.php b/application/modules/opac/controllers/BibController.php index 6dd31c5fce53fe5c5caeffe22309a8a91a211151..7123dc1e0b90329323aa1a2f956c3a4f4aa7701c 100644 --- a/application/modules/opac/controllers/BibController.php +++ b/application/modules/opac/controllers/BibController.php @@ -88,7 +88,6 @@ class BibController extends ZendAfi_Controller_Action { function selectionAction() { - xdebug_break(); $this->view->titre = $this->view->_('Sélection de bibliothèques pour la recherche'); $this->view->zones = Class_Zone::findAll(); $this->view->id_bibs_session = []; diff --git a/application/modules/opac/views/scripts/bib/selection.phtml b/application/modules/opac/views/scripts/bib/selection.phtml index a4369d215c5bd726c701fd2c378602d0e190a06b..c1400e2b7308281f8b0c0a2bd0eba7a03c2ce8e8 100644 --- a/application/modules/opac/views/scripts/bib/selection.phtml +++ b/application/modules/opac/views/scripts/bib/selection.phtml @@ -14,7 +14,8 @@ foreach($this->zones as $zone ) { echo '<li>' . $this->tag('h2', $zone->getLibelle()); $bibs = Class_Bib::findAllBy(['id_zone' => $zone->getId(), - 'visibilite' => 2]); + 'visibilite' => 2, + 'order' => 'libelle']); echo ('<ul>'); foreach($bibs as $bib) { $coche = in_array($bib->getId(), $this->id_bibs_session) ? ['checked' => 'checked'] : []; diff --git a/library/ZendAfi/Controller/Plugin/SelectionBib.php b/library/ZendAfi/Controller/Plugin/SelectionBib.php index da03cd565f1d33b088e5942be3921279f6243e0c..c612a17120d8f76d413e561230cf6665addc993b 100644 --- a/library/ZendAfi/Controller/Plugin/SelectionBib.php +++ b/library/ZendAfi/Controller/Plugin/SelectionBib.php @@ -101,7 +101,7 @@ class ZendAfi_Controller_Plugin_SelectionBib extends Zend_Controller_Plugin_Abst protected function setIdBibsParams($request) { if(! $id_bibs = $request->getParam('bib_select')) - return []; + return; if(!is_array($id_bibs)) $id_bibs = explode(',', $id_bibs); diff --git a/library/ZendAfi/View/Helper/Accueil/RechSimple.php b/library/ZendAfi/View/Helper/Accueil/RechSimple.php index c68a6424862c3cb54d25af02c5fc813fb0eb331f..4f81002c351271a4ea06c123d1b7e28c56f83c49 100644 --- a/library/ZendAfi/View/Helper/Accueil/RechSimple.php +++ b/library/ZendAfi/View/Helper/Accueil/RechSimple.php @@ -57,4 +57,12 @@ class ZendAfi_View_Helper_Accueil_RechSimple extends ZendAfi_View_Helper_Accueil $this->division); return $this->getHtmlArray(); } + + + public function shouldCacheContent() { + if ((int)$this->preferences["select_bib"] !== 1) + return parent::shouldCacheContent(); + + return false; + } } \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php b/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php index 03cb2b7234ec95c8b7b0a79a353fb1750b461d24..3154c52c3ea6a07e53badc752eebf89b05b6d520 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/RechSimpleTest.php @@ -78,4 +78,44 @@ class ZendAfi_View_Helper_Accueil_RechSimpleWithoutAutocompleteTest extends Zend $this->assertNotXPath($this->_head_script, '//script[contains(@src,"search_autocomplete.js")]'); } } + + + +class ZendAfi_View_Helper_Accueil_RechSimpleWithCacheActifTest extends ZendAfi_View_Helper_Accueil_RechSimpleTestCase { + public function setUp() { + parent::setUp(); + Class_AdminVar::newInstanceWithId('CACHE_ACTIF', ['valeur' => '1']); + + } + + + /** @test */ + public function cacheContentShouldBeEnabled() { + $this->assertTrue($this->_helper->shouldCacheContent()); + } +} + + + +class ZendAfi_View_Helper_Accueil_RechSimpleWithCacheActifAndSelectBibEnabledTest extends ViewHelperTestCase { + public function setUp() { + parent::setUp(); + Class_AdminVar::newInstanceWithId('CACHE_ACTIF', ['valeur' => '1']); + $this->_helper = new ZendAfi_View_Helper_Accueil_RechSimple(1, + ['division' => 1, + 'type_module' => 'RECH_SIMPLE', + 'preferences' => [ + 'boite' => '', + 'titre' => 'Search widget', + 'select_bib' => '1']]); + + $this->_helper->setView(new ZendAfi_Controller_Action_Helper_View()); + } + + + /** @test */ + public function cacheContentShouldBeDisabeld() { + $this->assertFalse($this->_helper->shouldCacheContent()); + } +} ?> \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php b/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php index dd0447e093dcd641a58c9743492272dfeaf7abf9..65140ed9c06c5c37b75147514dc3cf398af460b1 100644 --- a/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php +++ b/tests/library/ZendAfi/View/Helper/TagRechercheSimpleTest.php @@ -21,7 +21,7 @@ require_once('ViewHelperTestCase.php'); -class ZendAfi_View_Helper_TagRechercheSimpleTest extends ViewHelperTestCase { +class ZendAfi_View_Helper_TagRechercheSimpleDefaultTest extends ViewHelperTestCase { /** @var ZendAfi_View_Helper_TagRechercheSimple */ protected $_helper; @@ -33,7 +33,6 @@ class ZendAfi_View_Helper_TagRechercheSimpleTest extends ViewHelperTestCase { public function setUp() { parent::setUp(); - $view = new ZendAfi_Controller_Action_Helper_View(); $this->_helper = new ZendAfi_View_Helper_TagRechercheSimple(); $this->_helper->setView($view); @@ -77,7 +76,7 @@ class ZendAfi_View_Helper_TagRechercheSimpleTest extends ViewHelperTestCase { -class ZendAfi_View_Helper_TagRechercheSimpleTestWithSessionParams extends ViewHelperTestCase { +class ZendAfi_View_Helper_TagRechercheSimpleWithSessionParamsTest extends ViewHelperTestCase { public function setUp() { parent::setUp();