diff --git a/VERSIONS_HOTLINE/54111 b/VERSIONS_HOTLINE/54111 new file mode 100644 index 0000000000000000000000000000000000000000..44120370aa926f01a0d922142343e5648863fbec --- /dev/null +++ b/VERSIONS_HOTLINE/54111 @@ -0,0 +1 @@ + - ticket #54111 : Boite bibliothèque : sélectionner le champ à afficher "horaire" affiche toutes les horaires, comme sur la fiche bibliothèque. \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/RenderLibrary.php b/library/ZendAfi/View/Helper/RenderLibrary.php index 80a993e248ac52c0169383cacc2eedcca3a3abdb..8ff9a63500235aaf9d32789b6702bd5ff2de7032 100644 --- a/library/ZendAfi/View/Helper/RenderLibrary.php +++ b/library/ZendAfi/View/Helper/RenderLibrary.php @@ -125,10 +125,11 @@ class ZendAfi_View_Helper_RenderLibrary extends ZendAfi_View_Helper_BaseHelper { protected function renderOpeningHours() { - if (!strlen($this->library->getHoraire())) - return ''; + $openings = $this->library->getHoraire() + ? $this->library->getHoraire() + : $this->view->libraryOpenings($this->library); - return $this->_renderField($this->_escapeInfo($this->library->getHoraire()), + return $this->_renderField($this->_escapeInfo($openings), 'field-opening-hours'); } diff --git a/tests/application/modules/opac/controllers/BibControllerTest.php b/tests/application/modules/opac/controllers/BibControllerTest.php index eb8092906929e84b20eeb8e690653bca8babd1d1..f6c3b788dce6ce06df50eeb7afdd045bf26c6b23 100644 --- a/tests/application/modules/opac/controllers/BibControllerTest.php +++ b/tests/application/modules/opac/controllers/BibControllerTest.php @@ -592,7 +592,7 @@ class BibControllerBibViewAnnecyHideNewsTest extends BibControllerBibViewTestCas -class BibControllerBibViewAnnecyRangeOpeningsTest extends BibControllerBibViewTestCase { +abstract class BibControllerLibraryWithOpeningsTestCase extends BibControllerBibViewTestCase { public function setUp() { parent::setUp(); @@ -651,7 +651,15 @@ class BibControllerBibViewAnnecyRangeOpeningsTest extends BibControllerBibViewTe 'debut_apres_midi' => '00:00', 'fin_apres_midi' => '00:00', 'label' => 'Repos']); + } +} + + + +class BibControllerBibViewAnnecyRangeOpeningsTest extends BibControllerLibraryWithOpeningsTestCase { + public function setUp() { + parent::setUp(); $this->dispatch('bib/bibview/id/4', true); } @@ -1261,6 +1269,7 @@ abstract class BibControllerWidgetPageTestCase extends BibControllerWithThreeBib $this->_preferences = ['titre' => 'Bibliotheques', 'libraries' => '4;1;2', 'nb_aff' => 3, + 'fields' => 'opening_hours', 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_SELECTION, 'filters' => 'custom_field_7;custom_field_5;custom_field_3;opening;town;territory;search']; @@ -1385,6 +1394,12 @@ class BibControllerWidgetPageSelectOpenLibrariesTest extends BibControllerWidget } + /** @test */ + public function openingHoursShouldBePresent() { + $this->assertXPathContentContains('//div[@class="field-opening-hours"]//li', '10h - 12h'); + } + + /** @test */ public function widgetShouldRenderLibraryCran() { $this->assertXPathContentContains('//div[@class="boite library"]//section/h2', 'Cran');