diff --git a/VERSIONS_HOTLINE/122611 b/VERSIONS_HOTLINE/122611 new file mode 100644 index 0000000000000000000000000000000000000000..da88326fd3468113634cabdbeea8a3afa6e8eb0c --- /dev/null +++ b/VERSIONS_HOTLINE/122611 @@ -0,0 +1 @@ + - ticket #122611 : Cosmogramme / Profil de données : correction de l'affichage de la zone et champs utilisés pour prendre le centre d'intérêt lorsque ce paramétrage n'est pas initialisé \ No newline at end of file diff --git a/VERSIONS_HOTLINE/122685 b/VERSIONS_HOTLINE/122685 new file mode 100644 index 0000000000000000000000000000000000000000..93d22ea8f4220a2c273a35a6859911cb14fadd62 --- /dev/null +++ b/VERSIONS_HOTLINE/122685 @@ -0,0 +1 @@ + - ticket #122685 : Affichage de toutes les collections dans le titre de la notice \ No newline at end of file diff --git a/VERSIONS_HOTLINE/123680 b/VERSIONS_HOTLINE/123680 new file mode 100644 index 0000000000000000000000000000000000000000..aa779fa337b0a2b6638b64511a588d8e85198541 --- /dev/null +++ b/VERSIONS_HOTLINE/123680 @@ -0,0 +1 @@ + - ticket #123680 : Magasin de thèmes : ajout des classes CSS 'facet_block_toggle_visibility' et 'facet_block_closed' sur les blocs de facettes pliées par défaut dans le résultat de recherche. \ No newline at end of file diff --git a/VERSIONS_HOTLINE/123836 b/VERSIONS_HOTLINE/123836 new file mode 100644 index 0000000000000000000000000000000000000000..d4b926431da68fd5e1fa77955548717aa40941c5 --- /dev/null +++ b/VERSIONS_HOTLINE/123836 @@ -0,0 +1 @@ + - ticket #123836 : Formulaires dans les articles : le sujet du mail envoyé à la validation du formulaire est maintenant sous la forme : [ libellé du portail ] titre de l'article. \ No newline at end of file diff --git a/VERSIONS_HOTLINE/123849 b/VERSIONS_HOTLINE/123849 new file mode 100644 index 0000000000000000000000000000000000000000..25d071bc9024cc9e2b2635ce0b10fc778078ef0d --- /dev/null +++ b/VERSIONS_HOTLINE/123849 @@ -0,0 +1 @@ + - ticket #123849 : Correctif sur la gestion des favoris, il est maintenant possible de selectionner des domaines favoris sans selectionner de bibliothèques favorites si la variable "ENABLE_BOOKMARKABLE_LIBRARIES" est désactivée. \ No newline at end of file diff --git a/VERSIONS_HOTLINE/124421 b/VERSIONS_HOTLINE/124421 new file mode 100644 index 0000000000000000000000000000000000000000..cb94171b06026d93c459cfb7e5993106136f5978 --- /dev/null +++ b/VERSIONS_HOTLINE/124421 @@ -0,0 +1 @@ + - ticket #124421 : Magasin de thèmes : amélioration du comportement d'adaptabilité des carrousels de mise en avant du thème Chili. \ No newline at end of file diff --git a/application/modules/opac/controllers/AbonneController.php b/application/modules/opac/controllers/AbonneController.php index 8ad77132b55f0aada354c77453b6526d5ae8e456..e94a952c3bfab6662f93fc61de415ef534b29544 100644 --- a/application/modules/opac/controllers/AbonneController.php +++ b/application/modules/opac/controllers/AbonneController.php @@ -1162,7 +1162,8 @@ class AbonneController extends ZendAfi_Controller_Action { $this->view->form = $form = ZendAfi_Form_User_Settings::forUser($this->_user); - if ($this->_request->isPost() && !$this->_getParam('library_ids')) { + if ($this->_request->isPost() && !$this->_getParam('library_ids') + && Class_AdminVar::isModuleEnabled('ENABLE_BOOKMARKABLE_LIBRARIES')) { $this->_helper->notify($this->_('Au moins une bibliothèque favorite doit être sélectionnée!')); return $this->_redirectToReferer(); } diff --git a/application/modules/opac/controllers/FormulaireController.php b/application/modules/opac/controllers/FormulaireController.php index cc16abf59ab60c405420b57f0a0182170bf5cb95..30ad3a24684f4ec85b201d39b41a826b99f66a00 100644 --- a/application/modules/opac/controllers/FormulaireController.php +++ b/application/modules/opac/controllers/FormulaireController.php @@ -56,7 +56,7 @@ class FormulaireController extends ZendAfi_Controller_Action { $mail = new ZendAfi_Mail('utf8'); $mail->setFrom(Class_Profil::getCurrentProfil()->getMailSiteOrPortail()) ->addTo($address) - ->setSubject('[ '.Class_Profil::getPortail()->getLibelle().' ] '. $this->_('Réponse formulaire :').' '.$subject) + ->setSubject('[ '.Class_Profil::getPortail()->getLibelle().' ] '.$subject) ->setBodyText($body); $this->_sendMail($mail); diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php index 49916fe80e411611a800465c41e505aa7f1768be..c6d6b5ef8492633fe7b83953b9c72caeb886c7a5 100644 --- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php +++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerTest.php @@ -1168,7 +1168,7 @@ class Cosmo_DataProfileControllerAutoFormatPostTest extends Cosmo_DataProfileCon -class Cosmo_DataProfileControllerMultiValuesTest extends Cosmo_DataProfileControllerTestCase { +abstract class Cosmo_DataProfileNanookTestCase extends Cosmo_DataProfileControllerTestCase { public function setUp() { parent::setUp(); @@ -1223,48 +1223,82 @@ class Cosmo_DataProfileControllerMultiValuesTest extends Cosmo_DataProfileContro 'index_file_uri_regex' => ['/.*']] ]]); + } +} + + + + +class Cosmo_DataProfileControllerZoneInteretTest extends Cosmo_DataProfileNanookTestCase { + + public function setUp() { + parent::setUp(); + $attribs = unserialize(Class_IntProfilDonnees::find(321)->getAttributs()); + $attribs['6'] = ['zone' => "", + 'champ' => ""]; + Class_IntProfilDonnees::find(321)->setAttributs(serialize($attribs))->save(); + + $this->dispatch('cosmo/data-profile/edit/id/321', true); } /** @test */ - public function nouveauteValeursShouldBeNouveauAndNew() { - $this->assertXPathContentContains('//script', 'values:{"nouveaute_valeurs":["nouveau","new"]}'); + public function interestShouldBeEmpty() { + $this->assertXPathContentContains('//script', + 'values:{"interest_zone":[""],"interest_champ":[""]}'); + } +} + + + + +class Cosmo_DataProfileControllerMultiValuesTest extends Cosmo_DataProfileNanookTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('cosmo/data-profile/edit/id/321', true); } /** @test */ - public function interestShouldBeTakeIn995AndZ() { - $this->assertXPathContentContains('//script', 'values:{"interest_zone":["995"],"interest_champ":["z"]}'); + public function nouveauteValeursShouldBeNouveauAndNew() { + $this->assertXPathContentContains('//script', + 'values:{"nouveaute_valeurs":["nouveau","new"]}'); } + /** @test */ + public function interestShouldBeTakeIn995AndZ() { + $this->assertXPathContentContains('//script', + 'values:{"interest_zone":["995"],"interest_champ":["z"]}'); + } /** @test */ public function itemUrlShouldBe995AndI() { - $this->assertXPathContentContains('//script', 'values:{"url_zone":["995"],"url_champ":["i"]}'); + $this->assertXPathContentContains('//script', + 'values:{"url_zone":["995"],"url_champ":["i"]}'); } /** @test */ public function scriptShouldSetMutiInputsItemIdOrigineTo001() { - $this->assertXPathContentContains('//script', 'values:{"id_origine_zone":["001"],"id_origine_champ":[null]}'); + $this->assertXPathContentContains('//script', + 'values:{"id_origine_zone":["001"],"id_origine_champ":[null]}'); } /** @test */ public function docTypeWithLabelSkipsShouldHaveAllItsValues() { - $this->assertXPathContentContains('//script', 'values:{"1_label":["am","bm","","em","mm","","","","","","",""],"1_zone":["BDA","BDJ","LFA","LFJ","LDA","LDJ","LCDA","LCDJ","PATIMP","PATMS","PERIP","PATINC"]}', - $this->_response->getBody()); + $this->assertXPathContentContains('//script', + 'values:{"1_label":["am","bm","","em","mm","","","","","","",""],"1_zone":["BDA","BDJ","LFA","LFJ","LDA","LDJ","LCDA","LCDJ","PATIMP","PATMS","PERIP","PATINC"]}'); } /** @test */ public function indexFileShouldContainsZone934FieldURegexStar() { - $this->assertXPathContentContains('//script', 'values:{"index_file_zone":["934"],"index_file_field":["u"],"index_file_uri_regex":["\/.*"]}', - $this->_response->getBody()); + $this->assertXPathContentContains('//script', + 'values:{"index_file_zone":["934"],"index_file_field":["u"],"index_file_uri_regex":["\/.*"]}'); } - - } diff --git a/cosmogramme/tests/php/classes/CarthameIntegrationTest.php b/cosmogramme/tests/php/classes/CarthameIntegrationTest.php index 38240eff0c6940c3043df297fbc1836ab0819eab..ab61d0fbc0166953901e831766b45384989967b4 100644 --- a/cosmogramme/tests/php/classes/CarthameIntegrationTest.php +++ b/cosmogramme/tests/php/classes/CarthameIntegrationTest.php @@ -114,7 +114,7 @@ class TangoMangoCarthameIntegrationTest extends CarthameIntegrationTestCase { * @test * */ public function importFromFileShouldUpdateNotice($notice) { - $this->assertEquals('TangoMango n° 2<br /> La Gazette du pirate', $notice->getTitrePrincipal()); + $this->assertEquals('TangoMango n° 2<br />La Gazette du pirate', $notice->getTitrePrincipal()); } @@ -130,6 +130,6 @@ class TangoMangoCarthameIntegrationTest extends CarthameIntegrationTestCase { Class_Notice::clearCache(); $notice = Class_Notice::find(7939934); - $this->assertEquals('Tangomango n° 2<br /> La gazette du pirate', $notice->getTitrePrincipal()); + $this->assertEquals('Tangomango n° 2<br />La gazette du pirate', $notice->getTitrePrincipal()); } } diff --git a/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php b/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php index a043852ed8b0e5c3866759c580bd9d46765e6ca7..864a71fc1723c5438d0c9c261828e792f6e01297 100644 --- a/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NanookRecordsIntegrationTest.php @@ -546,7 +546,7 @@ class NanookRecordsIntegrationSerialLiensFamiliauxTest extends NanookRecordsInte /** @test */ public function firstArticleShouldBeOnEstPasDesChiens() { - $this->assertEquals("Revue Quart Monde n° 231<br /> «On n’est pas des chiens !» : Editorial", $this->notice->getArticlesPeriodique()[0]['titre']); + $this->assertEquals("Revue Quart Monde n° 231<br />«On n’est pas des chiens !» : Editorial", $this->notice->getArticlesPeriodique()[0]['titre']); } } diff --git a/library/Class/Notice.php b/library/Class/Notice.php index 6389e9c7767364a216abe53ad709580c59035bc2..a73521fc5a4e35dba3169fcc1c8df831ab99b996 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -184,7 +184,6 @@ class Class_Notice extends Storm_Model_Abstract { $_has_many = ['exemplaires' => ['model' => 'Class_Exemplaire', 'role' => 'notice', 'dependents' => 'delete']], - $_titre_principal, $_auteur_principal, $_avis, $_moderated_avis, @@ -218,7 +217,8 @@ class Class_Notice extends Storm_Model_Abstract { 'created_at' => null, 'type' => self::TYPE_BIBLIOGRAPHIC, 'z3950_retry' => 0, - 'file_content' => '']; + 'file_content' => '', + 'unimarc' => '']; public function __construct() { @@ -893,23 +893,17 @@ class Class_Notice extends Storm_Model_Abstract { public function getTitrePrincipal($separator = BR) { - // 200$a - $titre = $this->getRecordTitle(); + $titles = array_map([$this, 'filtreTitre'], + $this->get_subfield(461, 't')); - // On cherche le chapeau et le n° - if ($data = $this->get_subfield("461", "t")) { - $chapeau = $this->filtreTitre($data[0]); - if ($chapeau) - { - if ($titre == $chapeau) $titre = ""; - $data=$this->get_subfield('461','v'); - $tome = isset($data[0]) ? $data[0] : null; - if ($tome) $chapeau .= " n° " . $tome; - if ($titre) $titre = $chapeau . $separator . $titre; - else $titre = $chapeau; - } - } - return $this->filtreTitre($titre); + if (!in_array($record_title = $this->filtreTitre($this->getRecordTitle()), + $titles)) + $titles []= $record_title; + + if ($volume = $this->getVolume()) + $titles[0] = $titles[0] . ' n° ' . $volume; + + return implode($separator, array_filter($titles)); } @@ -926,7 +920,6 @@ class Class_Notice extends Storm_Model_Abstract { public function getTitreEtSousTitre($separator=BR) { - unset ($this->_titre_principal); return implode(' : ', array_filter([$this->getTitrePrincipal($separator), $this->getSubtitle()])); diff --git a/library/Class/NoticeUnimarc.php b/library/Class/NoticeUnimarc.php index 862afd9c17bd9654f569e4729da4f8c02512d2cf..7bb1bc69297d16fe76715db9582f11d05f075c85 100644 --- a/library/Class/NoticeUnimarc.php +++ b/library/Class/NoticeUnimarc.php @@ -104,7 +104,7 @@ class Class_NoticeUnimarc { public function set_subfield($zone, $sous_zone, $valeur) { - $this->inner_data[$zone] = [$this->rgx_subfield_begin.$sous_zone.$valeur.$this->rgx_field_end]; + $this->inner_data[$zone] = [' '.$this->rgx_subfield_begin.$sous_zone.$valeur.$this->rgx_field_end]; return $this; } diff --git a/library/Class/ProfilePrefs.php b/library/Class/ProfilePrefs.php index a7e1d86d1e2514d63faa719da27e197b17fe8063..7ce52ba6207ec24d8af66b8c2128a2c27b1ab77c 100644 --- a/library/Class/ProfilePrefs.php +++ b/library/Class/ProfilePrefs.php @@ -129,14 +129,11 @@ class Class_ProfilePrefs extends Class_Entity { if (!$interet_prefs = $this->getPrefs()[6]) return $default; - if (!$interet_zone = $interet_prefs['zone']) + if (!isset($interet_prefs['zone'])) return $default; - if (!$interet_champ = $interet_prefs['champ']) - return $default; - - return ['interest_zone' => [$interet_zone], - 'interest_champ' => [$interet_champ]]; + return ['interest_zone' => [$interet_prefs['zone']], + 'interest_champ' => [$interet_prefs['champ']]]; } diff --git a/library/templates/Chili/Library/Settings.php b/library/templates/Chili/Library/Settings.php index e87e1a7ff232d5d3fe09ba825a81c3b3d4090c5d..c82ec4b595d5fa393e59c3cfccd8f1490f361aa3 100644 --- a/library/templates/Chili/Library/Settings.php +++ b/library/templates/Chili/Library/Settings.php @@ -109,6 +109,9 @@ class Chili_Library_Settings extends Intonation_Library_Settings { $hydrating_mapping['button class accordion_button'] = 'btn btn-link'; $hydrating_mapping['div class wall_grid_lg'] = 'd-none d-lg-block'; $hydrating_mapping['div class wall_grid_md'] = 'd-lg-none'; + $hydrating_mapping['div class highlight_carousel_xl'] = 'd-none d-xl-block'; + $hydrating_mapping['div class highlight_carousel_md'] = 'd-none d-md-block d-xl-none'; + $hydrating_mapping['div class highlight_carousel_sm'] = 'd-md-none'; $settings[$this->_template->withNameSpace('hydrating_mapping')] = $hydrating_mapping; return $settings; diff --git a/library/templates/Chili/View/Abonne.php b/library/templates/Chili/View/Abonne.php index 1d2bdbc6b7db396c4d2ed5c46f9330a63a5ecf1b..5e7c0c62b153503015c7de2356ef0f306eb9c66f 100644 --- a/library/templates/Chili/View/Abonne.php +++ b/library/templates/Chili/View/Abonne.php @@ -51,11 +51,9 @@ class Chili_View_Abonne extends ZendAfi_View_Helper_BaseHelper { protected function _renderCarouselForSmallScreen($sections) { - $content = (new Intonation_View_RenderMultipleCarousel()) - ->setView($this->view) - ->setNumberOfColumns(3) - ->renderMultipleCarousel($sections, - [$this->view, 'cardify']); + $content = $this->view->renderMultipleCarousel($sections, + [$this->view, 'cardify'], + 3); return $this->_div(['class' => 'big_buttons_sm'], $content); diff --git a/library/templates/Chili/View/AbstractHighlightCarousel.php b/library/templates/Chili/View/AbstractHighlightCarousel.php index e767ab4791b55e40a507e4601f88f385f4c59dc9..84390a18131e5e87fe550ade78a13c151376263d 100644 --- a/library/templates/Chili/View/AbstractHighlightCarousel.php +++ b/library/templates/Chili/View/AbstractHighlightCarousel.php @@ -29,6 +29,20 @@ class Chili_View_AbstractHighlightCarousel extends Intonation_View_RenderMultipl $_columns_class; + protected function _renderCarousel($collection, $callback) { + $html = [$this->_div(['class' => 'highlight_carousel_xl'], + parent::_renderCarousel($collection, $callback)), + + $this->_div(['class' => 'highlight_carousel_md'], + $this->view->renderMultipleCarousel($collection, $callback, 3)), + + $this->_div(['class' => 'highlight_carousel_sm'], + $this->view->renderCarousel($collection, $callback))]; + + return $this->view->grid($html); + } + + protected function _carouselInner($collection, $id, $callback) { $cards = array_filter($collection->injectInto([], function($html, $element) use ($callback) { diff --git a/library/templates/Intonation/Library/View/Wrapper/Abstract.php b/library/templates/Intonation/Library/View/Wrapper/Abstract.php index 5590d3ff8df827fd49437a964e8da3df9e3e2df0..18cdb61c82d04d7fc1e7b488f5162291902e1459 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Abstract.php +++ b/library/templates/Intonation/Library/View/Wrapper/Abstract.php @@ -124,14 +124,14 @@ abstract class Intonation_Library_View_Wrapper_Abstract { } - protected function _getInUtilsIco($ico_key) { - return $this->getIco($ico_key, 'utils'); + protected function _getInUtilsIco($ico_key, $attribs = []) { + return $this->getIco($ico_key, 'utils', $attribs); } /** @return string */ - public function getIco($key, $category) { - return Class_Template::current()->getIco($this->_view, $key, $category); + public function getIco($key, $category, $attribs = []) { + return $this->_view->templateIco($key, $category, $attribs); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Article.php b/library/templates/Intonation/Library/View/Wrapper/Article.php index ada5e39ba67d962ad3750c3a1a5e10599173c6ef..ad0435f67e05b2da32dfb1cd94d4d6b075e772b5 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Article.php +++ b/library/templates/Intonation/Library/View/Wrapper/Article.php @@ -186,7 +186,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr if ($this->_model->hasEventsDebut()) $actions [] = new Intonation_Library_Link(['Url' => $this->_urlForModel('opac', 'cms', 'ical'), - 'Image' => $this->_getIco('ical', 'library'), + 'Image' => $this->getIco('ical', 'library'), 'Text' => $this->_('ICAL'), 'Attribs' => ['target' => '_blank'], 'Title' => $this->_('Ajouter l\'événement %s dans mon calendrier', @@ -203,7 +203,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr if (Class_Users::isCurrentUserCanAccesBackend()) { $actions [] = new Intonation_Library_Link(['Url' => $this->_urlForModel('admin', 'cms', 'edit'), 'Attribs' => ['class' => 'menu_admin_front_anchor'], - 'Image' => $this->_getIco('edit', 'utils'), + 'Image' => $this->_getInUtilsIco('edit'), 'Text' => $this->_('Modifier …'), 'Popup' => true, 'Title' => $this->_('Modifier l\'article %s', @@ -211,7 +211,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr $actions [] = new Intonation_Library_Link(['Url' => $this->_urlForModel('admin', 'cms', 'version'), 'Attribs' => ['class' => 'menu_admin_front_anchor'], - 'Image' => $this->_getIco('history', 'library'), + 'Image' => $this->getIco('history', 'library'), 'Text' => $this->_('Historique …'), 'Popup' => true, 'Title' => $this->_('Historique des modifications de l\'article %s', @@ -228,17 +228,12 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr 'Attribs' => ['class' => 'more_action'], 'Title' => $this->_('Voir plus d\'actions pour %s', $this->_model->getLibelle()), - 'Image' => $this->_getIco('more', 'utils')]); + 'Image' => $this->_getInUtilsIco('more')]); return [$this->_view->renderDropdown($this->_view->renderActions($actions), $button, 'dropleft dropup')]; } - protected function _getIco($ico, $type) { - return Class_Template::current()->getIco($this->_view, $ico, $type); - } - - protected function _urlForModel($module, $controller, $action) { return $this->_view->url(['module' => $module, 'controller' => $controller, diff --git a/library/templates/Intonation/Library/Widget/Carousel/View.php b/library/templates/Intonation/Library/Widget/Carousel/View.php index 6897ebd44f20756acd2a68f8db797b417c31841b..d1f97a2261094c6678e86f33752c0d219927de35 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/View.php @@ -240,7 +240,6 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help [new Storm_Collection($elements), $content_callback]); - } diff --git a/library/templates/Intonation/View/Author/RenderCollaborations.php b/library/templates/Intonation/View/Author/RenderCollaborations.php index ce2c521d3b2cc62210814a7d28a40fdb9ba29382..96096e02ff33bb80bfa227ecc86e5c998bdb7764 100644 --- a/library/templates/Intonation/View/Author/RenderCollaborations.php +++ b/library/templates/Intonation/View/Author/RenderCollaborations.php @@ -27,8 +27,7 @@ class Intonation_View_Author_RenderCollaborations extends ZendAfi_View_Helper_Ba }; return ($content = $this->view->renderMultipleCarousel(new Storm_Collection($author->getAssociatedAuthors()), - $callback, - 20)) + $callback)) ? $this->_tag('h3', $this->_('Auteurs associés')) . $content : ''; } diff --git a/library/templates/Intonation/View/RenderMultipleCarousel.php b/library/templates/Intonation/View/RenderMultipleCarousel.php index 7202862ce650b9ff259fc2b1a01fe3a355fe9b5d..8794b6df34e56db4573bfe1242a89970eca750f6 100644 --- a/library/templates/Intonation/View/RenderMultipleCarousel.php +++ b/library/templates/Intonation/View/RenderMultipleCarousel.php @@ -21,14 +21,20 @@ class Intonation_View_RenderMultipleCarousel extends Intonation_View_Abstract_Carousel { + protected $_columns = 5; - public function renderMultipleCarousel($collection, $callback) { + + public function renderMultipleCarousel($collection, $callback, $number_of_columns = '') { + $this->setNumberOfColumns($number_of_columns); return $this->_renderCarousel($collection, $callback); } public function setNumberOfColumns($columns) { + if (!$columns) + return $this; + $this->_columns = $columns; return $this; } diff --git a/library/templates/Intonation/View/Search/Facets.php b/library/templates/Intonation/View/Search/Facets.php index 3a65917dfa17266b207dfeac0b0d8d74f79710a8..6b3b48f31298fd2e3653268eca2ab8cc4c828316 100644 --- a/library/templates/Intonation/View/Search/Facets.php +++ b/library/templates/Intonation/View/Search/Facets.php @@ -37,29 +37,29 @@ class Intonation_View_Search_Facets extends ZendAfi_View_Helper_Facettes { $this->_criteres = (new Intonation_Library_Search_Criteria) ->from($criteres); - $this->_addToggleScript(); - return $this->_HTMLfacets($criteres, $facets); } protected function _rubriqueHTML($rubrique, $type, $facets, $url) { - $onclick = $this->_shouldBeClosed($type) - ? "$(this).next().slideToggle();" + $could_be_closed = $this->_couldBeClosed($type); + $toggle_class = 'facet_block_closed'; + + $onclick = $could_be_closed + ? sprintf('$(this).next().slideToggle(\'complete\', function() {$(this).parent().toggleClass(\'%s\');});', $toggle_class) : ''; - $rubrique = $onclick - ? $rubrique . Class_Template::current()->getIco($this->view, 'below', 'utils', ['class' => 'ml-3']) - : $rubrique; + if ($could_be_closed) + $rubrique .= $this->view->templateIco('below', 'utils', ['class' => 'ml-3']); return $this->_tag('li', - $this->_tag('b', $rubrique, ($onclick ? ['onclick' => $onclick] : [])) - . $this->listeFacettesElementHTML($type, $facets[$type], $url, (boolean) $onclick), - ['class' => 'facette_titre facet_type_' . $type]); + $this->_tag('b', $rubrique, ($could_be_closed ? ['onclick' => $onclick] : [])) + . $this->listeFacettesElementHTML($type, $facets[$type], $url, $could_be_closed), + ['class' => 'facette_titre facet_type_' . $type . ($could_be_closed ? sprintf(' facet_block_toggle_visibility %s', $toggle_class) : '')]); } - protected function _shouldBeClosed($type) { + protected function _couldBeClosed($type) { $facets_closed = $this->_preferences['facets_closed_codes']; return false !== strpos($facets_closed, $type); } diff --git a/library/templates/Intonation/View/TemplateIco.php b/library/templates/Intonation/View/TemplateIco.php new file mode 100644 index 0000000000000000000000000000000000000000..d27f0ed28c9d67793cb2f18639acfafebfd132d4 --- /dev/null +++ b/library/templates/Intonation/View/TemplateIco.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Intonation_View_TemplateIco extends ZendAfi_View_Helper_BaseHelper { + public function templateIco($key, $category, $attribs = []) { + return Class_Template::current()->getIco($this->view, $key, $category, $attribs); + } +} diff --git a/tests/application/modules/opac/controllers/AbonneControllerLoansHistoryNanookTest.php b/tests/application/modules/opac/controllers/AbonneControllerLoansHistoryNanookTest.php index 7f68542a247dc17d513278bfc3325c2ed66b7c94..369980f94ba0f1e0dcbf4777871dfb3810cb6fa6 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerLoansHistoryNanookTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerLoansHistoryNanookTest.php @@ -62,7 +62,6 @@ abstract class AbonneControllerLoansHistoryNanookTestCase extends AbstractContro $this->fixture('Class_Notice', ['id' => 464732, 'type_doc' => Class_TypeDoc::LIVRE, - 'unimarc' => '', 'exemplaires' => [$this->fixture('Class_Exemplaire', ['id' => 5, 'code_barres' => 231645, diff --git a/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php b/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php index ef7c68cc7f260e3fb4bff7594858af943ac3a722..bba27d69df0dafc079cbba347e45b2ca9c294042 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php @@ -241,6 +241,40 @@ class AbonneControllerSettingsFormPostTest extends AbonneControllerSettingsTestC } + + +class AbonneControllerSettingsBookmarkedLibDisabledTest extends AbonneControllerSettingsTestCase { + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_Bib', + ['id' => 59, + 'libelle' => 'ANNECY']); + + Class_AdminVar::set('ENABLE_BOOKMARKABLE_LIBRARIES', false); + + $this->postDispatch('/abonne/manage-settings', + ['domain_ids' => '1-2']); + } + + + /** @test */ + public function userSettingsShouldHaveBeenUpdated() { + $this->assertEquals([$this->_music, $this->_sport], $this->_user->getBookmarkedDomains()); + } + + + /** @test */ + public function userSettingsShouldHaveBeenUpdatedWithNoLibs() { + $this->assertEquals(0, count($this->_user->getBookmarkedLibraries())); + } +} + + + + + class AbonneControllerSettingsFormChangeTest extends AbonneControllerSettingsTestCase { public function setUp() { @@ -250,6 +284,8 @@ class AbonneControllerSettingsFormChangeTest extends AbonneControllerSettingsTes ['id' => 59, 'libelle' => 'ANNECY']); + Class_AdminVar::set('ENABLE_BOOKMARKABLE_LIBRARIES', true); + $this->_user ->setBookmarkedLibraries([56]) ->save(); diff --git a/tests/application/modules/opac/controllers/FormulaireControllerTest.php b/tests/application/modules/opac/controllers/FormulaireControllerTest.php index 37ec8f9aa8b372c2c155624092011c693991bb68..f5b219a426650fdcaed5322e4a7983f1d1d62781 100644 --- a/tests/application/modules/opac/controllers/FormulaireControllerTest.php +++ b/tests/application/modules/opac/controllers/FormulaireControllerTest.php @@ -104,7 +104,7 @@ class FormulaireControllerWithEmailPostActionTest extends FormulaireControllerPo /** @test */ public function emailSubjectShouldBeFormSent() { - $this->assertContains('[ portail ] Réponse formulaire : Contactez nous', quoted_printable_decode($this->mock_transport->getSentMails()[0]->getSubject())); + $this->assertContains('[ portail ] Contactez nous', quoted_printable_decode($this->mock_transport->getSentMails()[0]->getSubject())); } } diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index cbd0e0c53ffdcfc67032d5d23e999151236747a6..9adfe6e154e3768f16e664cf6288fde7afa7d891 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -413,7 +413,8 @@ class RechercheControllerViewNoticeWithPreferencesTest extends RechercheControll $this->notice ->setClefChapeau('Gallimard serie') - ->set_subfield('461','t', 'Gallimard serie'); + ->set_subfield('461','t', 'Gallimard serie') + ->assertSave(); $preferences = [ 'barre_nav' => 'Document', @@ -638,7 +639,7 @@ class RechercheControllerViewNoticeWithPreferencesTest extends RechercheControll public function trackEventShouldContainsNoticeTitreAuteur() { $this->assertEquals(['recherche', 'notice', - '"titre: Gallimard serie<br /> Cinéma d\'animation","auteur: Bernard Génin","editeur: \"Cahiers du cinéma\"","tome: ","support: livres"', + '"titre: Gallimard serie<br />Cinéma d\'animation","auteur: Bernard Génin","editeur: \"Cahiers du cinéma\"","tome: ","support: livres"', 345], $this->_web_analytics_client->getAttributesForLastCallOn('trackEvent')); } @@ -797,7 +798,7 @@ class RechercheControllerViewNoticeMetasTest extends RechercheControllerNoticeTe /** @test */ public function pageShouldContainTitleMeta() { - $this->assertXPathContentContains('//meta[@property="og:title"]/@content', 'Cinéma d\'animation br/ 3D - Bernard Génin', $this->_response->getBody()); + $this->assertXPathContentContains('//meta[@property="og:title"]/@content', 'Cinéma d\'animation br/ 3D - Bernard Génin'); } diff --git a/tests/library/Class/NoticeTest.php b/tests/library/Class/NoticeTest.php index 9c3e9563d872709aba9b35567a028bb91ca46855..530dc080800a80752a22d37495703365a0fa5d89 100644 --- a/tests/library/Class/NoticeTest.php +++ b/tests/library/Class/NoticeTest.php @@ -1032,4 +1032,71 @@ class NoticeGetMatieresTest extends ModelTestCase { $this->assertEquals('ELECTRONIQUE ELEKTRONIK MANUELS MANUEL D00 ENSEIGNEMENT ANSAINEMAN SUPERIEUR SUPERIER', $record->getMatieres()); } +} + + + + +class NoticeTitleWithSeveral461Test extends ModelTestCase { + public function titlesForUnimarc() { + return [ + [ + 'Le gros titre', + [ + [200, ['a' => 'Le gros titre']], + ] + ], + + + [ + 'le monde n° 2', + [ + [200, ['a' => 'le monde']], + [461, ['t' => 'le monde', 'v' => 2]], + ] + ], + + + [ + 'Cinéma n° 2 : Documentaire : le gros titre', + [ + [200, ['a' => 'le gros titre']], + [461, ['t' => 'Cinéma', 'v' => 2]], + [461, ['t' => 'Documentaire']] + ] + ], + + [ + 'le monde n° 2', + [ + [200, ['a' => 'le monde']], + [461, ['t' => '[le >monde<]', 'v' => 2]], + ] + ], + + + [ + 'le monde n° 2', + [ + [461, ['t' => 'le monde', 'v' => 2]], + ] + ], + + ]; + } + + + /** + * @dataProvider titlesForUnimarc + * @test + */ + public function unimarcShouldGenerateMainTitle($expected_title, $zones) { + $unimarc = (new Class_NoticeUnimarc_Fluent)->zoneWithContent('001', '1234'); + foreach($zones as $zone) + $unimarc->zoneWithChildren($zone[0], $zone[1]); + + $record = Class_Notice::newInstance(['unimarc' => $unimarc->render()]); + $this->assertEquals($expected_title, + $record->getTitrePrincipal(' : ')); + } } \ No newline at end of file diff --git a/tests/scenarios/Templates/TemplatesLibraryTest.php b/tests/scenarios/Templates/TemplatesLibraryTest.php index 2fc4b13b4d15dc6c8aead5917841ce1171928d5b..1c4386aaeb2fcd3dbbafe091a5eaec2c30778acb 100644 --- a/tests/scenarios/Templates/TemplatesLibraryTest.php +++ b/tests/scenarios/Templates/TemplatesLibraryTest.php @@ -94,7 +94,7 @@ class TemplatesLibraryWidgetWithCarouselThreeColumnsTest extends TemplatesLibrar /** @test */ public function cardGridShouldContainsThreeCard() { - $this->assertXPathCount('//div[@class="carousel-item active"]//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")]', 3); + $this->assertXPathCount('//div[contains(@class, "boite ")]//div[@class="carousel-item active"]//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")]', 3); } diff --git a/tests/scenarios/Templates/TemplatesSearchTest.php b/tests/scenarios/Templates/TemplatesSearchTest.php index 8c28bdc616a65d236281b8341639cdb0c0bab866..c8e4a38d8a10d59224c1fdbfc25993c039cc24c0 100644 --- a/tests/scenarios/Templates/TemplatesSearchTest.php +++ b/tests/scenarios/Templates/TemplatesSearchTest.php @@ -397,6 +397,12 @@ class TemplatesSearchDispatchIntonationSearchListFormatWallTest extends Template public function masonryShouldBeLoaded() { $this->assertXPath('//head/script[contains(@src, "/masonry.js")]'); } + + + /** @test */ + public function facetsBlocksShouldContainsOnclickToggleClassFacetBlockClosed() { + $this->assertXPathContentContains('//form[contains(@class, "form_facets")]//ul/li[contains(@class, "facette_titre facet_type_A facet_block_toggle_visibility facet_block_closed")]/b[contains(@onclick, "$(this).parent().toggleClass(\'facet_block_closed\');")]', 'Auteur', $this->_response->getBody()); + } } diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index 08fc862e648d2d183c125af418ef9b2f7ac9e127..c6a11c1bcfd6b80cb2e23de92a3b9bc083410818 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -2355,7 +2355,7 @@ class TemplatesDispatchSearchWithFacetsTest extends TemplatesIntonationTestCase /** @test */ public function searchResultWithClosedFacetsShouldHaveOnclick() { - $this->assertXPath('//ul[contains(@class, "facet")]/li/b[contains(@onclick, ".slideToggle()")]'); + $this->assertXPath('//ul[contains(@class, "facet")]/li/b[contains(@onclick, ".slideToggle(")]'); } diff --git a/tests/scenarios/Templates/TemplatesWidgetTest.php b/tests/scenarios/Templates/TemplatesWidgetTest.php index 81538e7a02aadb6c0fba5d91bd2a86abb20f6f66..8c3215a3d199bfd405215160a53552b8da30dc99 100644 --- a/tests/scenarios/Templates/TemplatesWidgetTest.php +++ b/tests/scenarios/Templates/TemplatesWidgetTest.php @@ -1367,7 +1367,19 @@ class TemplatesWidgetWithLeftHighlightLayoutTest extends AbstractTemplatesWidget /** @test */ public function libraryMontminShouldBeHighlightedInCarouselSecondPage() { - $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide left_highlight_carousel")]//div[contains(@class, "carousel-item")][2]//div[contains(@class, "card-img-overlay")]//div[contains(@class, "card-title")]', 'Montmin'); + $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[@class= "highlight_carousel_xl d-none d-xl-block"]//div[contains(@class, "carousel slide left_highlight_carousel")]//div[contains(@class, "carousel-item")][2]//div[contains(@class, "card-img-overlay")]//div[contains(@class, "card-title")]', 'Montmin'); + } + + + /** @test */ + public function libraryAnnecyShouldBeInAMultipleCarousel() { + $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[@class="highlight_carousel_md d-none d-md-block d-xl-none"]//div[contains(@class, "multiple_carousel")]//div[contains(@class, "card-title")]', 'Annecy'); + } + + + /** @test */ + public function libraryAnnecyShouldBeInAOneColumnCarousel() { + $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[@class="highlight_carousel_sm d-md-none"]//div[@class = "carousel slide"]//div[contains(@class, "card-title")]', 'Annecy'); } }