diff --git a/library/ZendAfi/View/Helper/Search/Header.php b/library/ZendAfi/View/Helper/Search/Header.php index 77cba1c37c15c21eea9bc60557fb921ede9664b0..43f4bed600be077a9e3c9250a278b40497099c01 100644 --- a/library/ZendAfi/View/Helper/Search/Header.php +++ b/library/ZendAfi/View/Helper/Search/Header.php @@ -41,7 +41,7 @@ class ZendAfi_View_Helper_Search_Header extends ZendAfi_View_Helper_BaseHelper { $this->_tagDomainBrowser(), $this->_tagSearchActions(), $this->view->tagSearchExtension($this->_criteria), - $this->view->getHelper('TagSelectRecord')->tagRecordSelectionCount($this->_criteria)]; + $this->_tagRecordSelectionCount()]; return $this->_tag('div', implode( @@ -171,4 +171,10 @@ class ZendAfi_View_Helper_Search_Header extends ZendAfi_View_Helper_BaseHelper { 'data-popup' => true]), ['class' => 'save']); } + + + protected function _tagRecordSelectionCount() { + return $this->view->getHelper('TagSelectRecord') + ->tagRecordSelectionCount($this->_criteria); + } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/TagSelectRecord.php b/library/ZendAfi/View/Helper/TagSelectRecord.php index 0df8172959e6e8514ed8cb609c27eb2fa13bb6f9..9f862b9011e38337327defe121ec653daa985f6b 100644 --- a/library/ZendAfi/View/Helper/TagSelectRecord.php +++ b/library/ZendAfi/View/Helper/TagSelectRecord.php @@ -40,6 +40,9 @@ class ZendAfi_View_Helper_TagSelectRecord extends ZendAfi_View_Helper_BaseHelper public function tagRecordSelectionCount($criteria) { + if (!Class_AdminVar::isModuleEnabled('ENABLE_SEARCH_MULTIPLE_RECORD_SELECTION')) + return ''; + Class_ScriptLoader::getInstance() ->addInlineScript('function updateRecordSelectionCount(data) {' . '$(\'.record-selection span\').text(data.count); ' diff --git a/tests/scenarios/SearchSelection/SearchSelectionTest.php b/tests/scenarios/SearchSelection/SearchSelectionTest.php index e6bb3878235bc110a79dafa299cb1585c1568f74..cedd474ccd013c1e355f067cc54585899c45dedb 100644 --- a/tests/scenarios/SearchSelection/SearchSelectionTest.php +++ b/tests/scenarios/SearchSelection/SearchSelectionTest.php @@ -71,6 +71,23 @@ abstract class SearchSelectionTestCase extends AbstractControllerTestCase { +class SearchSelectionNotActivatedTest extends SearchSelectionTestCase { + public function setUp() { + parent::setUp(); + Class_AdminVar::set('ENABLE_SEARCH_MULTIPLE_RECORD_SELECTION', 0); + + $this->dispatch('/recherche/simple/expressionRecherche/*', true); + } + + + /** @test */ + public function pageShouldNotContainsselectionMenu() { + $this->assertNotXPath('//div[@class="record-selection"]/a[text()="Sélection : "]'); + } +} + + + class SearchSelectionWithEmptySessionTest extends SearchSelectionTestCase { public function setUp() {