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 dc071c2be61802f786b5a466f5bf913eb8c51549..570a6339caed9503f72bb04dbef126f772144d21 100644 --- a/library/ZendAfi/View/Helper/RenderLibrary.php +++ b/library/ZendAfi/View/Helper/RenderLibrary.php @@ -122,10 +122,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 cbc776635e989e728a02086b4d1c3737b325a792..0fcea8751be3473b9212ae7be4f2b3d85d7c0180 100644 --- a/tests/application/modules/opac/controllers/BibControllerTest.php +++ b/tests/application/modules/opac/controllers/BibControllerTest.php @@ -686,7 +686,7 @@ class BibControllerBibViewAnnecyByRewriteUrlWithLinkToProfilTest extends BibCont -class BibControllerBibViewAnnecyRangeOpeningsTest extends BibControllerBibViewTestCase { +abstract class BibControllerLibraryWithOpeningsTestCase extends BibControllerBibViewTestCase { public function setUp() { parent::setUp(); @@ -745,7 +745,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); } @@ -1411,6 +1419,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']; @@ -1535,6 +1544,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');