diff --git a/VERSIONS_HOTLINE/123632 b/VERSIONS_HOTLINE/123632 new file mode 100644 index 0000000000000000000000000000000000000000..d347c3907f83a3c64b990ef79b43d3b4f1a2a4d1 --- /dev/null +++ b/VERSIONS_HOTLINE/123632 @@ -0,0 +1 @@ + - ticket #123632 : Magasin de thèmes : Amélioration du rebond nouveauté dans le résultat de recherche. Le badge et le critère de recherche nouveauté correspondent. \ No newline at end of file diff --git a/VERSIONS_HOTLINE/123841 b/VERSIONS_HOTLINE/123841 new file mode 100644 index 0000000000000000000000000000000000000000..cbd5b339b9314ee26afa26c8cc9b13e1af8568ad --- /dev/null +++ b/VERSIONS_HOTLINE/123841 @@ -0,0 +1 @@ + - ticket #123841 : RSS : Correction pour la validité du flux RSS \ No newline at end of file diff --git a/VERSIONS_HOTLINE/124536 b/VERSIONS_HOTLINE/124536 new file mode 100644 index 0000000000000000000000000000000000000000..81e9909c291c1865da3054f43e40312f1c4cc30e --- /dev/null +++ b/VERSIONS_HOTLINE/124536 @@ -0,0 +1 @@ + - ticket #124536 : Magasin de thèmes : amélioration des liste de prêts et de réservations. \ No newline at end of file diff --git a/VERSIONS_HOTLINE/124540 b/VERSIONS_HOTLINE/124540 new file mode 100644 index 0000000000000000000000000000000000000000..92e987b4da0c834d4891b3d79eb3e19f8021aaac --- /dev/null +++ b/VERSIONS_HOTLINE/124540 @@ -0,0 +1 @@ + - ticket #124540 : Recherche Avancée : Correction de l'ordre d'affichage des champs dans un formulaire de recherche avancée quand on utilise des axes Titre Auteur Mot-clé \ No newline at end of file diff --git a/VERSIONS_HOTLINE/125119 b/VERSIONS_HOTLINE/125119 new file mode 100644 index 0000000000000000000000000000000000000000..54c21e3f1e685cdececa5f529614e2cf8da25878 --- /dev/null +++ b/VERSIONS_HOTLINE/125119 @@ -0,0 +1 @@ + - ticket #125119 : Magasin de thèmes : correction du lien plus de facettes dans le résultat de recherche. \ No newline at end of file diff --git a/VERSIONS_HOTLINE/performances b/VERSIONS_HOTLINE/performances new file mode 100644 index 0000000000000000000000000000000000000000..757153efa116b5a804a18ddec49d5f8b33818ad8 --- /dev/null +++ b/VERSIONS_HOTLINE/performances @@ -0,0 +1 @@ + - Cosmogramme : amélioration de la performance des intégrations \ No newline at end of file diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index ced79492d0930a853edde813bb905bdca585e35c..20a3e8c116e35aa4e9c8d8201a9dce447a1c6eb2 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -805,9 +805,6 @@ class notice_integration { foreach($exemplaires as $exemplaire) $exemplaire->save(); - if($record = Class_Notice::find($id_notice)) - $record->setDateMaj(dateDuJour(2))->save(); - (new Class_Cosmogramme_Integration_RawRecord($this->_raw_data, $this->notice['id_origine'], $this->id_int_bib)) @@ -829,7 +826,7 @@ class notice_integration { if ($unicite_codes_barres == Class_CosmoVar::UNIQ_BARCODE_WITHIN_LIBRARY) $delete_duplicates_args['id_int_bib'] = $this->id_int_bib; - Class_Exemplaire::deleteBy($delete_duplicates_args); + Class_Exemplaire::basicDeleteBy($delete_duplicates_args); return $this; } @@ -1493,4 +1490,4 @@ class Service_Runner { public function run($type, $args) { return communication::runService($type, $args); } -} \ No newline at end of file +} diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationAloesTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationAloesTest.php index bfa5ea5c9acc6a1ddfeef88d76c4d10537f64f36..7ed7b2708bd09a05f35e5fb1b675b64fdcb38284 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationAloesTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationAloesTest.php @@ -356,7 +356,7 @@ class NoticeIntegrationAloesDimancheALaPiscineTest extends NoticeIntegrationAloe 'id_int_bib' => 1, 'code_barres' => [2060303] ], - Class_Exemplaire::getLoader()->getFirstAttributeForLastCallOn('deleteBy') + Class_Exemplaire::getLoader()->getFirstAttributeForLastCallOn('basicDeleteBy') ); } @@ -550,4 +550,4 @@ class NoticeIntegrationAloesUnimarcTest extends NoticeIntegrationAloesTestCase { public function databaseShouldNotHaveRecord() { $this->assertEquals(0, Class_Notice::count()); } -} \ No newline at end of file +} diff --git a/library/Class/CustomField/NullModelValues.php b/library/Class/CustomField/NullModelValues.php index d32286db78a0490a71ccc09d4c8cd2ed6844ec4c..e303bdf32c4e5b2b06e762a194c243dcf6d682b8 100644 --- a/library/Class/CustomField/NullModelValues.php +++ b/library/Class/CustomField/NullModelValues.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -50,7 +50,7 @@ class Class_CustomField_NullModelValues extends Class_CustomField_ModelValues{ } - public function getFieldValues() { + public function getFieldValues($callback = null) { return []; } @@ -59,4 +59,4 @@ class Class_CustomField_NullModelValues extends Class_CustomField_ModelValues{ return $this; } } -?> \ No newline at end of file +?> diff --git a/library/Class/Journal/ProfileType.php b/library/Class/Journal/ProfileType.php index f6e5e4bdc0ebbe3bbda2413e5cd7f34acb8d2785..34456a995cddf62d53a88d57138fff2fc41b5c21 100644 --- a/library/Class/Journal/ProfileType.php +++ b/library/Class/Journal/ProfileType.php @@ -39,7 +39,8 @@ class Class_Journal_ProfileType extends Class_Journal_Type { $current = $model->getRawAttributes(); $previous = $model->getRawDbAttributes(); - $this->_journal->addDetail(static::NEW_VALUE, json_encode(static::_unserialize($current['cfg_accueil']))); + if (isset($current['cfg_accueil'])) + $this->_journal->addDetail(static::NEW_VALUE, json_encode(static::_unserialize($current['cfg_accueil']))); if (!isset($previous['cfg_accueil'])) return true; diff --git a/library/Class/MoteurRecherche.php b/library/Class/MoteurRecherche.php index e6eb31d2cee95e77f3281cefda20c2b43ee62099..379d63238467b502024451740a00290c3101c7ac 100644 --- a/library/Class/MoteurRecherche.php +++ b/library/Class/MoteurRecherche.php @@ -161,10 +161,7 @@ class Class_MoteurRecherche { return; } - $axes = ['titres', 'auteurs', 'editeur', 'collection', 'matieres', 'dewey']; - - if (trim(Class_CosmoVar::get('other_index_fields'))) - $axes []= 'other_terms'; + $axes = ['titres', 'auteurs', 'editeur', 'collection', 'matieres', 'dewey', 'other_terms']; $quoted_expression = Zend_Db_Table_Abstract::getDefaultAdapter()->quote($expression); $match_condition = 'MATCH(' . implode(', ', $axes) . ')' . $against; @@ -316,9 +313,13 @@ class Class_MoteurRecherche { public function visitNouveaute($nouveaute) { + $month = is_numeric($nouveaute) + ? (int) $nouveaute + : 0; + $now = $this->getTimeSource()->time(); $novel_time = mktime(0, 0, 0, - date('m', $now) - (int)$nouveaute, + date('m', $now) - $month, date('d', $now), date('Y', $now)); @@ -762,4 +763,4 @@ class Class_MoteurRecherche { return $this; } -} \ No newline at end of file +} diff --git a/library/Class/Notice.php b/library/Class/Notice.php index a73521fc5a4e35dba3169fcc1c8df831ab99b996..32a107f66da7f214d8958ee8bd91b7971f614c2f 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -1171,7 +1171,7 @@ class Class_Notice extends Storm_Model_Abstract { * @return string */ protected function _getAuteurDansZone($data, $avec_fonction = false) { - $auteur = $this->_getAuteurDansSousChamps($this->decoupe_bloc_champ($data)); + $auteur = $this->_getAuteurDansSousChamps($this->decoupe_bloc_champ($data), $avec_fonction); $libelle = $auteur->nom . '|' . $auteur->prenom; if ($avec_fonction) $libelle .= '|' . $auteur->fonction . '|' . $auteur->fonction_pergame; @@ -1195,7 +1195,7 @@ class Class_Notice extends Storm_Model_Abstract { * @param $data array * @return stdClass */ - protected function _getAuteurDansSousChamps($data) { + protected function _getAuteurDansSousChamps($data, $avec_fonction = false) { $auteur = new stdClass(); $fonction_pergame = $auteur->nom = $auteur->prenom = $auteur->fonction_pergame = ''; @@ -1213,7 +1213,7 @@ class Class_Notice extends Storm_Model_Abstract { continue; } - if ($item['code'] == '4') { + if (($item['code'] == '4') && $avec_fonction) { $fonctions []= (is_numeric($valeur) && ($codif_fonction = Class_CodifAuteurFonction::find($valeur))) ? $codif_fonction->getLibelle() : $valeur; @@ -1948,4 +1948,4 @@ class Class_Notice extends Storm_Model_Abstract { return $this->getLoader()->findFirstBy(['clef_oeuvre' => implode('-', $clef_oeuvre_parent), 'type_doc' => Class_TypeDoc::PERIODIQUE_TITLE]); } -} \ No newline at end of file +} diff --git a/library/Class/NoticeUnimarc/Fluent.php b/library/Class/NoticeUnimarc/Fluent.php index c009bf706d52db88f5065621022834f4814d654b..6914b8b95df517464eb6cf04894ce92beef672a0 100644 --- a/library/Class/NoticeUnimarc/Fluent.php +++ b/library/Class/NoticeUnimarc/Fluent.php @@ -227,7 +227,7 @@ class Class_NoticeUnimarc_Zone { public function addChild($code, $value) { $this->_sub_zones - ->append((new Class_NoticeUnimarc_SubZone)->code($code)->value($value)); + ->append(new Class_NoticeUnimarc_SubZone($code, $value)); $this->_content = null; return $this; @@ -276,6 +276,11 @@ class Class_NoticeUnimarc_SubZone { $_code, $_value; + public function __construct($code, $value) { + $this->_code = $code; + $this->_value = $value; + } + public function code($code) { $this->_code = $code; return $this; @@ -338,4 +343,4 @@ class Class_NoticeUnimarc_LegacyVisitor { return $this; } -} \ No newline at end of file +} diff --git a/library/ZendAfi/Controller/Action/Helper/RenderRss.php b/library/ZendAfi/Controller/Action/Helper/RenderRss.php index 9a899b3f0d6dacff25ddd1f6535b5aaaa8c5b378..35176a3ab8093f1433ed4e3c00a0d4760ea40dd0 100644 --- a/library/ZendAfi/Controller/Action/Helper/RenderRss.php +++ b/library/ZendAfi/Controller/Action/Helper/RenderRss.php @@ -102,7 +102,7 @@ abstract class ZendAfi_Controller_Action_Helper_RenderRssAbstract { [ 'title' => html_entity_decode($data->getTitre()), 'link' => $this->getUrlLink($data), - 'guid' => $data->getId(), + 'guid' => $this->getUrlLink($data), 'lastUpdate' => $this->lastUpdate($data), 'description' => $this->getDescriptionForElement($data) ]; diff --git a/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php b/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php index 20260353a2ab37b307002ef3b85b2080ec04d251..9dce5cfc797599ee209d63fde272993e89913816 100644 --- a/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php +++ b/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php @@ -53,7 +53,11 @@ class ZendAfi_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Acti $this->view->profil = Class_Profil::getCurrentProfil(); $this->view->_current_module = $this->getRequest()->getParam("current_module"); - $this->view->initBoite($this->view->_current_module["preferences"]["boite"]); + + $template = isset($this->view->_current_module["preferences"]["boite"]) + ? $this->view->_current_module["preferences"]["boite"] + : null; + $this->view->initBoite($template); } diff --git a/library/ZendAfi/Controller/Plugin/Manager/CosmoVar.php b/library/ZendAfi/Controller/Plugin/Manager/CosmoVar.php index 8bcd3da431e5a31b0bd1dce803ee47fb8a7d7626..b47469b87e2cceca075f653a85e5a9fd43dcabb4 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/CosmoVar.php +++ b/library/ZendAfi/Controller/Plugin/Manager/CosmoVar.php @@ -52,7 +52,7 @@ class ZendAfi_Controller_Plugin_Manager_CosmoVar } - protected function _canDelete() { + protected function _canDelete($model) { return false; } } diff --git a/library/ZendAfi/Form/Decorator/SearchAxe.php b/library/ZendAfi/Form/Decorator/SearchAxe.php index e9eaee9fa32748c2e9ccf4026dc16009ce587fe9..56dc9d8286667c349741d96eb9192bdb13419515 100644 --- a/library/ZendAfi/Form/Decorator/SearchAxe.php +++ b/library/ZendAfi/Form/Decorator/SearchAxe.php @@ -26,21 +26,11 @@ class ZendAfi_Form_Decorator_SearchAxe extends Zend_Form_Decorator_Abstract { public function render($content) { $view = $this->_element->getView(); - return $view->tag('span', - $view->formSelect($this->_element->getAttrib('operator_prefix') - . $this->_element->getName(), - $this->_element->getAttrib('operator_value'), - [], - ['and' => $this->_('et'), - 'or' => $this->_('ou'), - 'and not' => $this->_('sauf')]), - ['class' => 'search_axe_operator_prefix']) - . $view->tag('span', $this->_element->getLabel(), ['class' => 'search_axe_label']) - . $view->tag('span', $view->formText($this->_element->getAttrib('input_prefix') + return $view->tag('span', $view->formText($this->_element->getAttrib('input_prefix') . $this->_element->getName(), $this->_element->getValue(), ['onkeypress' => $this->_element->getAttrib('onkeypress')]), - ['class' => 'search_axe_input']) - . BR; + ['class' => 'search_axe_input']); } + } diff --git a/library/ZendAfi/Form/Decorator/SearchAxeLabel.php b/library/ZendAfi/Form/Decorator/SearchAxeLabel.php new file mode 100644 index 0000000000000000000000000000000000000000..34a0a21acc44964405b29ce99396188bfef8ba1c --- /dev/null +++ b/library/ZendAfi/Form/Decorator/SearchAxeLabel.php @@ -0,0 +1,88 @@ +<?php +/** + * Copyright (c) 2012-2017, 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 ZendAfi_Form_Decorator_SearchAxeLabel extends Zend_Form_Decorator_Label { + + use Trait_Translator; + + + public function render($content) + { + $element = $this->getElement(); + $view = $element->getView(); + if (null === $view) { + return $content; + } + + $label = $this->getLabel(); + $separator = $this->getSeparator(); + $placement = $this->getPlacement(); + $tag = $this->getTag(); + $id = $this->getId(); + $class = $this->getClass(); + $options = $this->getOptions(); + + + if (empty($label) && empty($tag)) { + return $content; + } + + $wrap = ['tag' => 'div'] ; + if (isset($options['wrap'])) { + $wrap = $options['wrap']; + unset($options['wrap']); + } + + if (!empty($label)) { + $options['class'] = $class; + $label = $view->formLabel($element->getFullyQualifiedName(), trim($label), $options); + } else { + $label = ' '; + } + + if (null !== $tag) { + require_once 'Zend/Form/Decorator/HtmlTag.php'; + $decorator = new Zend_Form_Decorator_HtmlTag(); + $decorator->setOptions(array('tag' => $tag)); + $label = $decorator->render($label); + } + + $form_select = $view->tag('span', + $view->formSelect($this->_element->getAttrib('operator_prefix') + . $this->_element->getName(), + $this->_element->getAttrib('operator_value'), + [], + ['and' => $this->_('et'), + 'or' => $this->_('ou'), + 'and not' => $this->_('sauf')]), + ['class' => 'search_axe_operator_prefix']); + + $label = $view->tag($wrap['tag'], $form_select . $label); + + switch ($placement) { + case self::APPEND: + return $content . $separator . $label; + case self::PREPEND: + return $label . $separator . $content; + } + } +} diff --git a/library/ZendAfi/Form/Element/SearchAxe.php b/library/ZendAfi/Form/Element/SearchAxe.php index 111ed65f16d1c70b5c8c6b4a77b78cc64af4f7cb..a5fa1debf2b0d14ce1eecbee6c7dccd80642141b 100644 --- a/library/ZendAfi/Form/Element/SearchAxe.php +++ b/library/ZendAfi/Form/Element/SearchAxe.php @@ -21,12 +21,16 @@ class ZendAfi_Form_Element_SearchAxe extends Zend_Form_Element { - protected $_disableLoadDefaultDecorators = true; public function __construct($spec, $options = null) { parent::__construct($spec, $options); - $this->_decorators['label'] = new ZendAfi_Form_Decorator_SearchAxe(); + $this->_decorators = ['SearchAxe' => new ZendAfi_Form_Decorator_SearchAxe()] + + $this->_decorators; + $this->_decorators['label'] = new ZendAfi_Form_Decorator_SearchAxeLabel(); + + $this->removeDecorator('ViewHelper'); + $this ->setAttrib('operator_prefix', 'operateur_') ->setAttrib('input_prefix', 'rech_') diff --git a/library/ZendAfi/View/Helper/Facettes.php b/library/ZendAfi/View/Helper/Facettes.php index a5b216e00edd00c58aff1c76da6ce7898b5da67c..3d82585c3818ac7debc59f84b2170d712312ce81 100644 --- a/library/ZendAfi/View/Helper/Facettes.php +++ b/library/ZendAfi/View/Helper/Facettes.php @@ -48,7 +48,7 @@ class ZendAfi_View_Helper_Facettes extends ZendAfi_View_Helper_BaseHelper { protected function _addToggleScript() { Class_ScriptLoader::getInstance() - ->addJQueryReady(sprintf('$(".%s .msg>a").click(function(e){ ' + ->addJQueryReady(sprintf('$(".%s .msg > a").click(function(e){ ' .'e.preventDefault();' .'var anchor = $(this);' .'anchor.next("ul").find("li").hide().appendTo(anchor.parent().closest("ul")).slideToggle();' diff --git a/library/storm b/library/storm index 49099cb341a0f6f4e8b95cbfc34d928289a10bd0..aad764a8e1f92d102da4e194ea564c398d20d7be 160000 --- a/library/storm +++ b/library/storm @@ -1 +1 @@ -Subproject commit 49099cb341a0f6f4e8b95cbfc34d928289a10bd0 +Subproject commit aad764a8e1f92d102da4e194ea564c398d20d7be diff --git a/library/templates/Intonation/Library/View/Wrapper/Abstract.php b/library/templates/Intonation/Library/View/Wrapper/Abstract.php index 18cdb61c82d04d7fc1e7b488f5162291902e1459..1cb748f6f421008efd88aea297b67e51be130359 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Abstract.php +++ b/library/templates/Intonation/Library/View/Wrapper/Abstract.php @@ -45,7 +45,7 @@ abstract class Intonation_Library_View_Wrapper_Abstract { ->setView($view) ->setModel($model); - $this->_widget_context = new Intonation_Library_Widget_Carousel_NullContext; + $this->setWidgetContext(new Intonation_Library_Widget_Carousel_NullContext); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Hold.php b/library/templates/Intonation/Library/View/Wrapper/Hold.php index 3bf19958318f0847a6f1fc0a4d24eb1d08343f06..3dcebcb02d30b85f0721fb41092b24b14cf41902 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Hold.php +++ b/library/templates/Intonation/Library/View/Wrapper/Hold.php @@ -161,6 +161,8 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp public function getBadges() { + $rang = $this->_model->getRang(); + $badges = [ ((new Intonation_Library_Badge) ->setTag('span') @@ -170,7 +172,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp ((new Intonation_Library_Badge) ->setTag('span') - ->setClass($this->_model->isWaitingToBePulled() ? 'success' : 'secondary') + ->setClass($this->_model->isWaitingToBePulled() ? 'badge-success' : 'badge-secondary') ->setImage(Class_Template::current()->getIco($this->_view, 'library', 'library')) @@ -186,14 +188,17 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp ((new Intonation_Library_Badge) ->setTag('span') ->setClass('badge-secondary') - ->setText($this->_model->getRang()) - ->setTitle($this->_('Rang de la réservation: %s', $this->_model->getRang()))) + ->setText($this->_('Rang %d', $rang)) + ->setTitle($this->_plural($rang - 1, + 'Le prochain document disponible est pour vous.', + 'Il y a 1 réservation avant la votre.', + 'Il y a %d réservations avant la votre.'))) ]; if ($end_availability = $this->_model->getFormattedAvailabilityEndDate()) $badges []= (new Intonation_Library_Badge) ->setTag('span') - ->setClass('warning') + ->setClass('badge-warning') ->setImage(Class_Template::current()->getIco($this->_view, 'library', 'agenda')) diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index 1e75d52d62fc80a95d0e4d0c66aa8f5fa9b280a9..3b206a4900190adb9baeb4c39a42ab60e7ca59d6 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -173,7 +173,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra : '')) ->setUrl($this->_view->url(['controller' => 'recherche', 'action' => 'simple', - 'nouveaute' => 1, + 'nouveaute' => 'maintenant', 'page' => null])) ->setText($this->_model->isNouveaute() ? $this->_('Nouveauté') : '') ->setTitle($this->_('Le document %s est nouveau dans votre bibliothèque', @@ -654,32 +654,10 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra public function getAnchor() { - $id = $this->_model->getId(); - - if (Intonation_Library_View_Wrapper_RecordCache::hasAnchorCache($id)) - return ''; - - Intonation_Library_View_Wrapper_RecordCache::setAnchorCache($id); - - return $this->_view->div(['class' => 'scroll_anchor', - 'id' => $id]); - } -} - - - - -class Intonation_Library_View_Wrapper_RecordCache { - protected static $_anchor_cache = []; - - - public static function hasAnchorCache($id) { - return isset(static::$_anchor_cache[$id]); - } - - - public static function setAnchorCache($id) { - static::$_anchor_cache[$id] = true; + return $this->_widget_context instanceOf Intonation_View_Search_Context + ? $this->_view->div(['class' => 'scroll_anchor', + 'id' => $this->_model->getId()]) + : ''; } } diff --git a/library/templates/Intonation/Library/View/Wrapper/Suggestion.php b/library/templates/Intonation/Library/View/Wrapper/Suggestion.php index 3708449999c2b01c66def6823ba64b79d673b74b..f3d5ad3f56899a2d23dd51e127d8476f38048618 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Suggestion.php +++ b/library/templates/Intonation/Library/View/Wrapper/Suggestion.php @@ -131,15 +131,13 @@ class Intonation_Library_View_Wrapper_Suggestion extends Intonation_Library_View ((new Intonation_Library_Badge) ->setTag('span') - ->setClass('badge-primary fs_1em') - ->setImage((Class_Template::current() - ->getIco($this->_view, - $this->getDocTypeLabel(), - 'doc_types'))) + ->setClass('badge-primary fs_1em suggestion_status') + ->setImage(($this->getIco($this->getDocTypeLabel(), + 'doc_types'))) ->setText($this->_model->getStatus()) - ->setTitle($this->_('Statut de la suggestion %s', - $this->getDocTypeLabel(), - $this->_model->getTitre())))]; + ->setTitle($this->_('Statut de la suggestion %s %s', + $this->_model->getTitre(), + $this->_model->getStatus())))]; if ($lib = $this->_model->getLibrary()) $badges [] = ((new Intonation_Library_Badge) diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php index 1c6a74f71fb88c1c95521984c682338acf628adb..83f7f63186fb2b437445c1bb2b4993170dd81e1b 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php @@ -48,7 +48,7 @@ class Intonation_Library_View_Wrapper_User_RichContent_Reviews extends Intonatio 'add', 'utils')])]; - return $this->_view->renderCollection(new Storm_Collection($reviews), $actions); + return $this->_view->renderCollection(new Storm_Collection($reviews), $actions, null, 20); } diff --git a/library/templates/Intonation/Library/Widget/Carousel/NullContext.php b/library/templates/Intonation/Library/Widget/Carousel/NullContext.php index cc3f687db2955d3925a7ad7504a058f36a7eddcd..b625bfcf80cf60b45cb54892225fac11da1fd6cc 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/NullContext.php +++ b/library/templates/Intonation/Library/Widget/Carousel/NullContext.php @@ -21,4 +21,10 @@ class Intonation_Library_Widget_Carousel_NullContext extends Class_Entity { + + public function getLinkToAllParams() { + return $params = parent::getLinkToAllParams() + ? $params + : []; + } } diff --git a/library/templates/Intonation/View/Abonne/Holds.php b/library/templates/Intonation/View/Abonne/Holds.php index 6b2b388f4cb767c2b88efa1a0ab8d7bad60948aa..c54e4c9aac775bdfbc87a720b36b96c362d574be 100644 --- a/library/templates/Intonation/View/Abonne/Holds.php +++ b/library/templates/Intonation/View/Abonne/Holds.php @@ -46,6 +46,6 @@ class Intonation_View_Abonne_Holds extends ZendAfi_View_Helper_BaseHelper { 'library')])] : []; - return $this->view->renderCollection(new Storm_Collection($holds), $actions); + return $this->view->renderCollection(new Storm_Collection($holds), $actions, null, 20); } } diff --git a/library/templates/Intonation/View/Abonne/LoansList.php b/library/templates/Intonation/View/Abonne/LoansList.php index ba4141bd734a48d734633270fba277827783c3ca..5b2056b66a2e71f4940f5c5a025b02b5fc469548 100644 --- a/library/templates/Intonation/View/Abonne/LoansList.php +++ b/library/templates/Intonation/View/Abonne/LoansList.php @@ -47,7 +47,7 @@ class Intonation_View_Abonne_LoansList extends ZendAfi_View_Helper_BaseHelper { $actions = $this->_getActions(); - return $this->view->renderCollection(new Storm_Collection($loans), $actions); + return $this->view->renderCollection(new Storm_Collection($loans), $actions, null, 20); } diff --git a/library/templates/Intonation/View/Abonne/PNBLoansList.php b/library/templates/Intonation/View/Abonne/PNBLoansList.php index 77543539c1848d694bb4dadaa78a8b5b5712082f..1d2041e6a842417c702eb3f7b466c1c3dfe30922 100644 --- a/library/templates/Intonation/View/Abonne/PNBLoansList.php +++ b/library/templates/Intonation/View/Abonne/PNBLoansList.php @@ -36,7 +36,7 @@ class Intonation_View_Abonne_PNBLoansList extends Intonation_View_Abonne_LoansLi }, $loans->getArrayCopy()); return $loans - ? $this->view->renderCollection(new Storm_Collection($loans)) + ? $this->view->renderCollection(new Storm_Collection($loans), [], null, 20) : ''; } } diff --git a/library/templates/Intonation/View/Abonne/Selections.php b/library/templates/Intonation/View/Abonne/Selections.php index c312508932f2997ec56c41b15dfcf91a27491619..dcd801d6ccc5d08dc8b655b0437ff9e5572b6c67 100644 --- a/library/templates/Intonation/View/Abonne/Selections.php +++ b/library/templates/Intonation/View/Abonne/Selections.php @@ -41,6 +41,6 @@ class Intonation_View_Abonne_Selections extends ZendAfi_View_Helper_BaseHelper { 'add', 'utils')])]; - return $this->view->renderCollection($collection, $actions); + return $this->view->renderCollection($collection, $actions, null, 20); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderCollection.php b/library/templates/Intonation/View/RenderCollection.php index 9cb7f83e4b6581d01e550dcb95c551666077444a..511d3f4b92de8b1f525b4f49c5b9cf8d665a12c5 100644 --- a/library/templates/Intonation/View/RenderCollection.php +++ b/library/templates/Intonation/View/RenderCollection.php @@ -21,7 +21,7 @@ class Intonation_View_RenderCollection extends ZendAfi_View_Helper_BaseHelper { - public function renderCollection($collection, $actions = [], $callback = null) { + public function renderCollection($collection, $actions = [], $callback = null, $page_size = 3) { $callback = $callback ? $callback : (function($item) @@ -36,7 +36,8 @@ class Intonation_View_RenderCollection extends ZendAfi_View_Helper_BaseHelper { $html = [$this->view->div(['class' => 'col-12'], $this->view->renderActions($actions)), $this->view->div(['class' => 'col-12'], $this->view->renderTruncateList($collection, - $callback))]; + $callback, + $page_size))]; return $this->view->grid(implode($html)); } diff --git a/library/templates/Intonation/View/RenderNewsletters.php b/library/templates/Intonation/View/RenderNewsletters.php index 2c815a3d1d177207fbc5530bdd152f94187e5b1e..fe8c15436496f636b9f83b6ea0e7316289d823b8 100644 --- a/library/templates/Intonation/View/RenderNewsletters.php +++ b/library/templates/Intonation/View/RenderNewsletters.php @@ -39,7 +39,7 @@ class Intonation_View_RenderNewsletters extends ZendAfi_View_Helper_BaseHelper { return $this->_tag('h3', $this->_('Les lettres d\'information')) . $this->_renderNewsletterAction() - . $this->view->renderTruncateList(new Storm_Collection($newsletters), $callback); + . $this->view->renderTruncateList(new Storm_Collection($newsletters), $callback, 20); } diff --git a/library/templates/Intonation/View/RenderTruncateList.php b/library/templates/Intonation/View/RenderTruncateList.php index ca259e99f3765172e06c74a684e00fd20d1f7d33..63ab702e26a707d72c7b88806f5ccbe4df094402 100644 --- a/library/templates/Intonation/View/RenderTruncateList.php +++ b/library/templates/Intonation/View/RenderTruncateList.php @@ -23,20 +23,24 @@ class Intonation_View_RenderTruncateList extends ZendAfi_View_Helper_BaseHelper { protected + $_page_size = 3, + $_ajax_size = 50, $_container_id, $_input_id; - public function renderTruncateList($collection, $callback) { + public function renderTruncateList($collection, $callback, $page_size = 3) { if ($collection->isEmpty()) return ''; + $this->_page_size = $page_size; + $size = $collection->count(); - if (50 < $size) + if ($this->_ajax_size < $size) return $this->_ajaxifyList($collection); - if (3 >= $size) + if ($this->_page_size >= $size) return $this->view->renderList($collection, $callback); $html = $collection @@ -50,13 +54,15 @@ class Intonation_View_RenderTruncateList extends ZendAfi_View_Helper_BaseHelper $this->_container_id = $id = uniqid(); $this->_input_id = 'input_' . $this->_container_id; + $tools = $this->_renderTools($size); return - $this->_renderTools($size) + $tools . $this->_tag('div', $html, ['id' => $this->_container_id, - 'class' => 'list-group bg-transparent no_border']); + 'class' => 'list-group bg-transparent no_border']) + . $tools; } @@ -74,7 +80,7 @@ class Intonation_View_RenderTruncateList extends ZendAfi_View_Helper_BaseHelper $input_keyup = "$('#" . $id . "').val(10000).change();" - . "setTimeout(function() { $('#" . $size_id . "').text($('#" . $this->_container_id . "').children(':visible').length); var searchText = $('#" . $this->_input_id . "').val(); if (!searchText || searchText == '' || searchText == '*') $('#" . $id . "').val(3).change();}, 10);"; + . "setTimeout(function() { $('#" . $size_id . "').text($('#" . $this->_container_id . "').children(':visible').length); var searchText = $('#" . $this->_input_id . "').val(); if (!searchText || searchText == '' || searchText == '*') $('#" . $id . "').val(" . $this->_page_size . ").change();}, 10);"; $multi_options = $this->_getTruncateOptions($size); @@ -118,22 +124,10 @@ class Intonation_View_RenderTruncateList extends ZendAfi_View_Helper_BaseHelper protected function _getTruncateOptions($size) { - if ($size > 50) - return ['3' => $this->_('3'), - '10' => $this->_('10'), - '50' => $this->_('50'), - '10000' => $this->_('Tout')]; - - if ($size > 10) - return ['3' => $this->_('3'), - '10' => $this->_('10'), + return [$this->_page_size => $this->_page_size, + $this->_page_size * 2 => $this->_page_size * 2, + $this->_page_size * 5 => $this->_page_size * 5, '10000' => $this->_('Tout')]; - - if ($size > 3) - return ['3' => $this->_('3'), - '10000' => $this->_('Tout')]; - - return ['10000' => $this->_('Tout')]; } @@ -144,7 +138,7 @@ class Intonation_View_RenderTruncateList extends ZendAfi_View_Helper_BaseHelper '#' . $this->_container_id . ' div.card *, .dropdown, .dropdown-menu') ->addJQueryReady("var container = $('#" . $this->_container_id . "');" - . "setTimeout(function() {container.children().slice(0,3).show();" + . "setTimeout(function() {container.children().slice(0, " . $this->_page_size . ").show();" . "$('#" . $this->_input_id . "').attr('onkeypress', 'return event.keyCode != 13;');}, 10);"); return $this; diff --git a/library/templates/Intonation/View/Search/Context.php b/library/templates/Intonation/View/Search/Context.php new file mode 100644 index 0000000000000000000000000000000000000000..5699698eb9f830694e4cb5e5c5bdaf7fe826edaf --- /dev/null +++ b/library/templates/Intonation/View/Search/Context.php @@ -0,0 +1,24 @@ +<?php +/** + * Copyright (c) 2012-2021, 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_Search_Context extends Intonation_Library_Widget_Carousel_NullContext { +} diff --git a/library/templates/Intonation/View/Search/Facets.php b/library/templates/Intonation/View/Search/Facets.php index 6b3b48f31298fd2e3653268eca2ab8cc4c828316..8e55492dece2861f3c931f83ff8035b8b95fa8fb 100644 --- a/library/templates/Intonation/View/Search/Facets.php +++ b/library/templates/Intonation/View/Search/Facets.php @@ -37,6 +37,8 @@ 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); } diff --git a/library/templates/Intonation/View/Search/Result.php b/library/templates/Intonation/View/Search/Result.php index 4a8cad52965ee94df0f913e04c7850604f42516d..70377afd4b86cbe8c8f3d46126ab78ad773f29b1 100644 --- a/library/templates/Intonation/View/Search/Result.php +++ b/library/templates/Intonation/View/Search/Result.php @@ -200,6 +200,7 @@ class Intonation_View_Search_Result extends ZendAfi_View_Helper_BaseHelper { return (new $wrapper_class) ->setModel($model) ->setView($this->view) + ->setWidgetContext(new Intonation_View_Search_Context) ->setSelectableAction(1) ->setAllowXSL(1); } diff --git a/tests/application/modules/AbstractControllerTestCase.php b/tests/application/modules/AbstractControllerTestCase.php index 9a4d9e8039e460964592a81a8b465df4431a192e..2c03c93ebaf52bc673b1d38e1bfbeb3d5d519d67 100644 --- a/tests/application/modules/AbstractControllerTestCase.php +++ b/tests/application/modules/AbstractControllerTestCase.php @@ -170,6 +170,7 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe Class_ScriptLoader::resetInstance(); Class_Codification::resetInstance(); Class_MoteurRecherche::resetInstance(); + Class_MoteurRecherche::setTimeSource(null); Class_WebService_Abstract::resetHttpClient(); Class_WebService_AllServices::setHttpClient(null); Class_I18n::reset(); @@ -182,6 +183,7 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe Class_Notice_Thumbnail_ResizeImage::reset(); Class_FileManager::reset(); Class_Notice_Xsl::reset(); + Class_Notice::setTimeSource(null); Class_CommSigb::setInstance(null); ZendAfi_Acl_AdminControllerGroup::setAcl(null); Class_Systeme_ModulesAccueil::reset(); diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index d7fd9d95fd7fc177be1be3efef0cf2f2692fea05..6cd875302c985c684ef07e37dc42fe739926c5c0 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -137,7 +137,7 @@ class CmsControllerdCalendarRssWithProfileAndArticleTest /** @test */ public function firstItemGuidShouldBeSha1LaFeteDeLaBanane() { $this->assertXPathContentContains('//channel/item[1]/guid', - '1'); + htmlspecialchars('cms/articleview/id/1', ENT_XML1)); } diff --git a/tests/application/modules/opac/controllers/RechercheControllerAtomTest.php b/tests/application/modules/opac/controllers/RechercheControllerAtomTest.php index 240824072122ba9f28600a6008bae312a10906eb..3aff712f67cf48e639a46fa107e1e24e6d589970 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerAtomTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerAtomTest.php @@ -86,13 +86,13 @@ class RechercheControllerAtomEmptyTest extends RechercheControllerAtomTestCase { protected function _prepareSql($sql) { $sql->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(HARRY HARRYS ARI) +(POTTER POTTERS POT)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+S1 +G123' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(HARRY HARRYS ARI) +(POTTER POTTERS POT)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+S1 +G123' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", true, false) ->answers([]) ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST(' (HARRY HARRYS ARI) (POTTER POTTERS POT)') and MATCH(facettes) AGAINST('+S1 +G123' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST(' (HARRY HARRYS ARI) (POTTER POTTERS POT)') and MATCH(facettes) AGAINST('+S1 +G123' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", true, false) ->answers([]) @@ -487,4 +487,4 @@ class RechercheControllerAtomWithAdvancedSearchTest extends RechercheControllerA } } -?> \ No newline at end of file +?> diff --git a/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php b/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php index a995f3d649cef62ed97134bd0a8cd4b723089d9e..2f62bd98716a46e0a01ef792eac2f58398fbc4b8 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php @@ -78,7 +78,7 @@ class RechercheControllerPrintActionWithRecordsTest extends AbstractControllerTe $mock_sql = $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(POMME POMMES POM)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+T3' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' POMME') * 1.5) + (MATCH(auteurs) AGAINST(' POMME')) desc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(POMME POMMES POM)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+T3' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' POMME') * 1.5) + (MATCH(auteurs) AGAINST(' POMME')) desc", true, false) ->answers([ diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index 9adfe6e154e3768f16e664cf6288fde7afa7d891..2c2742dd5b72550bf0148f1c988a0b4108faf726 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -181,7 +181,7 @@ class RechercheControllerPagerTest extends RechercheControllerNoticeTestCase { $records = array_map(function($i) { return [$i, ''];}, range(1, 45) ); $this->mock_sql ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(POMME POMMES POM)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+T3' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' POMME') * 1.5) + (MATCH(auteurs) AGAINST(' POMME')) desc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(POMME POMMES POM)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+T3' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' POMME') * 1.5) + (MATCH(auteurs) AGAINST(' POMME')) desc", true, false) ->answers($records) @@ -877,7 +877,7 @@ class RechercheControllerViewNoticeClefAlphaTest extends RechercheControllerNoti $this->mock_sql ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(MILLENIUM MILLENIUMS MILENIUM)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' MILLENIUM') * 1.5) + (MATCH(auteurs) AGAINST(' MILLENIUM')) desc", true, null) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(MILLENIUM MILLENIUMS MILENIUM)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' MILLENIUM') * 1.5) + (MATCH(auteurs) AGAINST(' MILLENIUM')) desc", true, null) ->answers([ [10, ''], [99, ''], @@ -3738,7 +3738,7 @@ class RechercheControllerNoExtensionTest extends AbstractControllerTestCase { $this->mock_sql = $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(VIE VIES) +(GEEK GEEKS JEK)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' VIE GEEKS') * 1.5) + (MATCH(auteurs) AGAINST(' VIE GEEKS')) desc", true, false) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(VIE VIES) +(GEEK GEEKS JEK)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' VIE GEEKS') * 1.5) + (MATCH(auteurs) AGAINST(' VIE GEEKS')) desc", true, false) ->answers([[1, '']]) ->beStrict(); @@ -3870,4 +3870,4 @@ class RechercheControllerAuthoritiesRecordHeirarchyWithHolesTest $this->dispatch('/opac/recherche/simple/authorities/HDOCU_8899_1'); $this->assertTrue($this->mock_sql->methodHasBeenCalled('fetchAll')); } -} \ No newline at end of file +} diff --git a/tests/application/modules/opac/controllers/RecordCustomLinksTest.php b/tests/application/modules/opac/controllers/RecordCustomLinksTest.php index 8f7862b04ad7f0dd6b9f04436b4822bb23e40829..81713a2a70a3c5faf20b235122be282c2cd94898 100644 --- a/tests/application/modules/opac/controllers/RecordCustomLinksTest.php +++ b/tests/application/modules/opac/controllers/RecordCustomLinksTest.php @@ -138,7 +138,7 @@ class RecordCustomLinksRechercheControllerWithBrazilTest extends RecordCustomLin Zend_Registry::set('sql', $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(BRAZIL BRAZILS BRAZIL)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' BRAZIL') * 1.5) + (MATCH(auteurs) AGAINST(' BRAZIL')) desc", true, false) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(BRAZIL BRAZILS BRAZIL)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' BRAZIL') * 1.5) + (MATCH(auteurs) AGAINST(' BRAZIL')) desc", true, false) ->answers([[888, '']])); $this->dispatch('/opac/recherche/simple/expressionRecherche/brazil'); @@ -182,4 +182,4 @@ class RecordCustomLinksRechercheControllerWithBackToFutureTest extends RecordCus 'external pdf', $this->_response->getBody()); } -} \ No newline at end of file +} diff --git a/tests/library/Class/MoteurRechercheTest.php b/tests/library/Class/MoteurRechercheTest.php index afd62d77b48bc7f2c3a6807f35847e7d38646e31..40e092aeeb2cd4a0a0be9e322963d859313f03e6 100644 --- a/tests/library/Class/MoteurRechercheTest.php +++ b/tests/library/Class/MoteurRechercheTest.php @@ -247,7 +247,7 @@ class MoteurRechercheSimpleTest extends MoteurRechercheTestCase { public function expectedSql() { - $match_axes = 'MATCH(titres, auteurs, editeur, collection, matieres, dewey)'; + $match_axes = 'MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms)'; return [ @@ -368,19 +368,19 @@ class MoteurRechercheSimpleTest extends MoteurRechercheTestCase { [['expressionRecherche' => 'coeur cabossés', 'tri' => 'alpha_titre'], 'nb_mots' => 2, - 'req_liste' => $this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(COEUR COEURS KER) +(CABOSSE CABOSSES KABOS)' IN BOOLEAN MODE)",'alpha_titre') + 'req_liste' => $this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(COEUR COEURS KER) +(CABOSSE CABOSSES KABOS)' IN BOOLEAN MODE)",'alpha_titre') ], [['expressionRecherche' => 'cœur cabossés', 'tri' => 'alpha_titre'], 'nb_mots' => 2, - 'req_liste' => $this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(COEUR COEURS KER) +(CABOSSE CABOSSES KABOS)' IN BOOLEAN MODE)",'alpha_titre') + 'req_liste' => $this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(COEUR COEURS KER) +(CABOSSE CABOSSES KABOS)' IN BOOLEAN MODE)",'alpha_titre') ], [['expressionRecherche' => 'oh læticia', 'tri' => 'alpha_titre'], 'nb_mots' => 1, - 'req_liste' => $this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(LAETICIA LAETICIAS LETISIA)' IN BOOLEAN MODE)",'alpha_titre') + 'req_liste' => $this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(LAETICIA LAETICIAS LETISIA)' IN BOOLEAN MODE)",'alpha_titre') ] ]; @@ -888,7 +888,7 @@ class MoteurRecherchePhonetixCollisionTest extends MoteurRechercheTestCase { public function shouldNotUsePhonetix() { $this->mock_sql ->whenCalled('fetchAll') - ->with($this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(JEAN JEANS) +(GENET GENETS) +(PARCOUR PARCOURS PARKOUR)' IN BOOLEAN MODE)", + ->with($this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(JEAN JEANS) +(GENET GENETS) +(PARCOUR PARCOURS PARKOUR)' IN BOOLEAN MODE)", "(MATCH(titres) AGAINST(' JEAN GENET PARCOURS') * 1.5) + (MATCH(auteurs) AGAINST(' JEAN GENET PARCOURS')) desc"), true, false) @@ -1119,14 +1119,14 @@ class MoteurRechercheExtendingTest extends MoteurRechercheTestCase { public function withoutResultShouldExtend() { $this->mock_sql ->whenCalled('fetchAll') - ->with($this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(VIE VIES) +(GEEK GEEKS JEK)' IN BOOLEAN MODE)", + ->with($this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(VIE VIES) +(GEEK GEEKS JEK)' IN BOOLEAN MODE)", "(MATCH(titres) AGAINST(' VIE GEEKS') * 1.5) + (MATCH(auteurs) AGAINST(' VIE GEEKS')) desc"), true, false) ->answers([]) ->whenCalled('fetchAll') - ->with($this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST(' (VIE VIES) (GEEK GEEKS JEK)')", + ->with($this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST(' (VIE VIES) (GEEK GEEKS JEK)')", "(MATCH(titres) AGAINST(' VIE GEEKS') * 1.5) + (MATCH(auteurs) AGAINST(' VIE GEEKS')) desc"), true, false) @@ -1151,7 +1151,7 @@ class MoteurRechercheExtendingTest extends MoteurRechercheTestCase { public function withoutResultWithNoExtensionParamShouldNotExtend() { $this->mock_sql ->whenCalled('fetchAll') - ->with($this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(VIE VIES) +(GEEK GEEKS JEK)' IN BOOLEAN MODE)", + ->with($this->listSqlWith("MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(VIE VIES) +(GEEK GEEKS JEK)' IN BOOLEAN MODE)", "(MATCH(titres) AGAINST(' VIE GEEKS') * 1.5) + (MATCH(auteurs) AGAINST(' VIE GEEKS')) desc"), true, false) @@ -1165,4 +1165,4 @@ class MoteurRechercheExtendingTest extends MoteurRechercheTestCase { $result = $this->_engine->lancerRecherche($criteria); $this->assertEquals(0, $result->getRecordsCount()); } -} \ No newline at end of file +} diff --git a/tests/scenarios/AdvancedSearch/AdvancedSearchTest.php b/tests/scenarios/AdvancedSearch/AdvancedSearchTest.php index 57ae528a33d159e7fb62cd45a8f9e93d72224fcf..7624ab5adcbf3df3345d5afe610a426e6e7f5b0f 100644 --- a/tests/scenarios/AdvancedSearch/AdvancedSearchTest.php +++ b/tests/scenarios/AdvancedSearch/AdvancedSearchTest.php @@ -1301,4 +1301,108 @@ class AdvancedSearchAuthoritySuggestTest extends AbstractControllerTestCase { $this->dispatch('/authority-suggest/suggest/type_autorite/auteur/valeur/herb/id_champ/author'); $this->assertXpathContentContains('//div[@clef="1"][contains(@onclick, "author")]', 'Herbert'); } -} \ No newline at end of file +} + + + + +class ZendAfi_View_Helper_RenderFormOrderInElementsDisplayTest extends ViewHelperTestCase { + /** @var ZendAfi_View_Helper_RenderForm */ + protected $_helper; + + /** @var string */ + protected $_html; + + public function setUp() { + parent::setUp(); + Class_ScriptLoader::resetInstance(); + + $view = new ZendAfi_Controller_Action_Helper_View(); + $this->_helper = new ZendAfi_View_Helper_RenderForm(); + $this->_helper->setView($view); + + $this->_form = $view->newForm(array('id' => 'form_personne')) + ->addElement('text', 'expressionRecherche', ['label' => "Chercher partout"]) + ->addElement('searchAxe', + 'titres', + ['label' => "Titre"]) + ->addElement('searchAxe', + 'auteurs', + ['label' => "Auteur"]) + ->addElement('searchAxe', + 'matieres', + ['label' => "Mot-clé"]) + ->addElement('select', + 'tri', + ['label' => 'Trier par', + 'onkeypress' => 'if (event.keyCode == 13) {$(this.form).submit();return false; }', + 'multiOptions' => (new Class_CriteresRecherche())->getListeTris()]) + + ->addElement('range', + 'annee', + ['label' => 'Publié entre (Année sous forme 1980)', + 'onkeypress' => 'if (event.keyCode == 13) {$(this.form).submit();return false; }', + 'separator' => '<br/> et ', + 'from_suffix' => '_debut', + 'to_suffix' => '_fin']) + + ->addElement('multiCheckbox', 'custom_multifacets_typedoc', + ['label' => ('Type de document'), + 'onkeypress' => 'if (event.keyCode == 13) {$(this.form).submit();return false; }', + 'multiOptions' => ['' => 'Tous', + 'T1' => 'Ouvrage' , + 'T11' => 'Articles', + 'T2' => 'Périodique' , + 'T17' => 'Périodique électronique', + 'T5' => 'Cédéroms', + 'T4' => 'Vidéo', + 'T15' => 'Livre électronique' + ],'autocomplete'=>'off']) + + + ->addElement('multiCheckbox', 'genre', + ['label' => '', + 'multiOptions' => ['G7' => 'Limiter aux ressources accessibles en ligne' + ], + 'autocomplete'=>'off' + ]) + + ->addUniqDisplayGroup( + 'recherche_avancee'); + + $this->_html = $this->_helper->renderForm($this->_form); + } + + + + /** @test */ + public function firstTrShouldContainsChercherPartout() { + $this->assertXPathContentContains($this->_html, + '//table//tr[1]/td[@class="droite"]', + 'Chercher partout'); + } + + + /** @test */ + public function secondTrShouldContainsTitre() { + $this->assertXPathContentContains($this->_html, + '//table//tr[2]/td//label', + 'Titre'); + } + + + /** @test */ + public function thirdTrShouldContainsAuteur() { + $this->assertXPathContentContains($this->_html, + '//table//tr[3]/td', + 'Auteur'); + } + + + /** @test */ + public function fourthTrShouldContainsMatiere() { + $this->assertXPathContentContains($this->_html, + '//table//tr[4]/td//label', + 'Mot-clé'); + } +} diff --git a/tests/scenarios/Authorities/AuthoritiesTest.php b/tests/scenarios/Authorities/AuthoritiesTest.php index e300b1bcec9398ff64c2443c0b19f2d05b69927c..6067170b911f6581e6488b3f9adfb552ae7b9009 100644 --- a/tests/scenarios/Authorities/AuthoritiesTest.php +++ b/tests/scenarios/Authorities/AuthoritiesTest.php @@ -214,7 +214,7 @@ class AuthoritiesAuthoritySearchControllerWithExpressionLocalAndAResultTest Zend_Registry::set('sql', $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(LOCAL LOCAUX LOKAL)' IN BOOLEAN MODE)) and type=2 order by (MATCH(titres) AGAINST(' LOCAL') * 1.5) + (MATCH(auteurs) AGAINST(' LOCAL')) desc", true, false) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(LOCAL LOCAUX LOKAL)' IN BOOLEAN MODE)) and type=2 order by (MATCH(titres) AGAINST(' LOCAL') * 1.5) + (MATCH(auteurs) AGAINST(' LOCAL')) desc", true, false) ->answers([[1, '']])); $this->dispatch('/opac/authority-search/index/expressionRecherche/local'); @@ -265,7 +265,7 @@ class AuthoritiesAuthoritySearchControllerWithExpressionLocalLimitedToFacetHMOTS Zend_Registry::set('sql', $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(LOCAL LOCAUX LOKAL)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+HMOTS' IN BOOLEAN MODE)) and type=2 order by (MATCH(titres) AGAINST(' LOCAL') * 1.5) + (MATCH(auteurs) AGAINST(' LOCAL')) desc", true, false) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(LOCAL LOCAUX LOKAL)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+HMOTS' IN BOOLEAN MODE)) and type=2 order by (MATCH(titres) AGAINST(' LOCAL') * 1.5) + (MATCH(auteurs) AGAINST(' LOCAL')) desc", true, false) ->answers([[1, '']])); $this->dispatch('/authority-search/index/facettes/HMOTS/expressionRecherche/local'); diff --git a/tests/scenarios/SearchByWork/SearchResultByWorkTest.php b/tests/scenarios/SearchByWork/SearchResultByWorkTest.php index c4f046bd4e92d8ad93b893e2428b3ed1de7a6f6e..91f4ca69f1077e8e5ba878a84b7982a9e6d84f5c 100644 --- a/tests/scenarios/SearchByWork/SearchResultByWorkTest.php +++ b/tests/scenarios/SearchByWork/SearchResultByWorkTest.php @@ -113,7 +113,7 @@ class SearchResultByWorkWithoutTemplatingTest extends SearchResultByWorkTestCase Zend_Registry::set('sql', $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(LAPIN LAPINS LAPIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' LAPIN') * 1.5) + (MATCH(auteurs) AGAINST(' LAPIN')) desc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(LAPIN LAPINS LAPIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' LAPIN') * 1.5) + (MATCH(auteurs) AGAINST(' LAPIN')) desc", true, false) ->answers([[1, '']])); @@ -144,7 +144,7 @@ class SearchResultByWorkWithTemplatingTest extends SearchResultByWorkTestCase { Zend_Registry::set('sql', $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes, clef_oeuvre from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(LAPIN LAPINS LAPIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' LAPIN') * 1.5) + (MATCH(auteurs) AGAINST(' LAPIN')) desc", + ->with("select id_notice, facettes, clef_oeuvre from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(LAPIN LAPINS LAPIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' LAPIN') * 1.5) + (MATCH(auteurs) AGAINST(' LAPIN')) desc", true, false) ->answers([[1, 'T1', 'ACCROCDUROC-PRATCHETTT'], @@ -222,7 +222,7 @@ abstract class SearchResultByWorkWithTemplatingWorkTestCase extends SearchResult ->answers(1) ->whenCalled('fetchAll') - ->with("select id_notice, facettes, clef_oeuvre from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(LAPIN LAPINS LAPIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' LAPIN') * 1.5) + (MATCH(auteurs) AGAINST(' LAPIN')) desc", + ->with("select id_notice, facettes, clef_oeuvre from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(LAPIN LAPINS LAPIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' LAPIN') * 1.5) + (MATCH(auteurs) AGAINST(' LAPIN')) desc", true, false) ->answers([[1, 'T1', 'ACCROCDUROC-PRATCHETTT'], diff --git a/tests/scenarios/SearchResult/SearchResultTest.php b/tests/scenarios/SearchResult/SearchResultTest.php index ceed2a8a01e350b9b01d67e3771189be7012e50d..d96f65eeeea835922dfcf1058982a7bdb6739df1 100644 --- a/tests/scenarios/SearchResult/SearchResultTest.php +++ b/tests/scenarios/SearchResult/SearchResultTest.php @@ -132,7 +132,7 @@ class SearhResultFilterDomainsFromProfilTest extends AbstractControllerTestCase $sql = $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(TROLL TROLLS TROL) +(TROY TROYS TROI)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+(T2) +(HCCCC0001 HCCCC0002)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' TROLLS TROY') * 1.5) + (MATCH(auteurs) AGAINST(' TROLLS TROY')) desc", true, false) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(TROLL TROLLS TROL) +(TROY TROYS TROI)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+(T2) +(HCCCC0001 HCCCC0002)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' TROLLS TROY') * 1.5) + (MATCH(auteurs) AGAINST(' TROLLS TROY')) desc", true, false) ->answers([ ['1' , 'T1 T2']]) ->beStrict(); @@ -163,7 +163,7 @@ class SearchResultFilterFromProfilTest extends AbstractControllerTestCase { $sql = $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(TROLL TROLLS TROL) +(TROY TROYS TROI)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+(T2)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' TROLLS TROY') * 1.5) + (MATCH(auteurs) AGAINST(' TROLLS TROY')) desc", true, false) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(TROLL TROLLS TROL) +(TROY TROYS TROI)' IN BOOLEAN MODE) and MATCH(facettes) AGAINST('+(T2)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' TROLLS TROY') * 1.5) + (MATCH(auteurs) AGAINST(' TROLLS TROY')) desc", true, false) ->answers([ ['1' , 'T1 T2']]); Zend_Registry::set('sql', $sql); diff --git a/tests/scenarios/Templates/ChiliTest.php b/tests/scenarios/Templates/ChiliTest.php index 953126ccd146be8981bdb26a38c9257e41c9aa51..effff3e2580f9bb6e6096e66f4471b86bba548ac 100644 --- a/tests/scenarios/Templates/ChiliTest.php +++ b/tests/scenarios/Templates/ChiliTest.php @@ -273,7 +273,7 @@ class ChiliTemplateSearchResultMoreOptionsTest extends ChiliTemplateTestCase { $sql = $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(JARDIN JARDINS JARDIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' JARDIN') * 1.5) + (MATCH(auteurs) AGAINST(' JARDIN')) desc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(JARDIN JARDINS JARDIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' JARDIN') * 1.5) + (MATCH(auteurs) AGAINST(' JARDIN')) desc", true, false) ->answers([[89, ''], [99, '']]) diff --git a/tests/scenarios/Templates/MuscleTemplateTest.php b/tests/scenarios/Templates/MuscleTemplateTest.php index 3dde55116f4d56a25677c7ab6c717156f3be1380..3a436b24c8471e81519cd9acc1af21fefaaa7cf6 100644 --- a/tests/scenarios/Templates/MuscleTemplateTest.php +++ b/tests/scenarios/Templates/MuscleTemplateTest.php @@ -342,7 +342,7 @@ class MuscleTemplateSearchResultMoreOptionsTest extends MuscleTemplateTestCase { $sql = $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(JARDIN JARDINS JARDIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' JARDIN') * 1.5) + (MATCH(auteurs) AGAINST(' JARDIN')) desc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(JARDIN JARDINS JARDIN)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' JARDIN') * 1.5) + (MATCH(auteurs) AGAINST(' JARDIN')) desc", true, false) ->answers([[89, ''], [99, '']]) @@ -578,4 +578,4 @@ class MuscleTemplateNotLoggedTest extends MuscleTemplateTestCase { public function inputLoginShouldBeHydratedWithOrder3() { $this->assertXPath('//form/input[@id="login"][@class= "zendafi_form_login_login btn btn-sm btn-primary order-3 my-3"]'); } -} \ No newline at end of file +} diff --git a/tests/scenarios/Templates/MyBibAppTemplateTest.php b/tests/scenarios/Templates/MyBibAppTemplateTest.php index c13b6dac48fe0f5510abcc26a2fd988c0f4efe25..e3918bcdefffc3109718b91b9f72ae1e2adfc153 100644 --- a/tests/scenarios/Templates/MyBibAppTemplateTest.php +++ b/tests/scenarios/Templates/MyBibAppTemplateTest.php @@ -367,7 +367,7 @@ class MyBibAppTemplateReadedInSerieTest extends MyBibAppTemplateTestCase { $sql = $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(TROLL TROLLS TROL)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' TROLLS') * 1.5) + (MATCH(auteurs) AGAINST(' TROLLS')) desc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(TROLL TROLLS TROL)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' TROLLS') * 1.5) + (MATCH(auteurs) AGAINST(' TROLLS')) desc", true, false) ->answers([[12, ''], [15, '']]) @@ -378,4 +378,4 @@ class MyBibAppTemplateReadedInSerieTest extends MyBibAppTemplateTestCase { $this->dispatch('/recherche/simple/id_profil/24/expressionRecherche/trolls'); $this->assertXPathContentContains('//span[contains(@class, "record_serie")]', '1 sur 2'); } -} \ No newline at end of file +} diff --git a/tests/scenarios/Templates/TemplatesAbonneTest.php b/tests/scenarios/Templates/TemplatesAbonneTest.php index 9c260ca146d81c8a582d083ad8f9181728ccf2cc..e996753107ffe307dab40fc379637befe8a41867 100644 --- a/tests/scenarios/Templates/TemplatesAbonneTest.php +++ b/tests/scenarios/Templates/TemplatesAbonneTest.php @@ -542,10 +542,91 @@ class TemplatesDispatchAbonneHoldsTest extends TemplatesIntonationAccountTestCas public function holdsDobbyPotterBadgeForAvailabilityEndDateShouldContainsSixJuin() { $this->assertXPathContentContains('//div[contains(@class,"badge_group_Intonation_Library_View_Wrapper_Hold")]//span[@title="Expire le: 06 juin"]', '06 juin'); } + + + /** @test */ + public function dobbyPotterHoldShouldHaveRank2() { + $this->assertXPathContentContains('//span[contains(@title, "Il y a 1 réservation avant la votre.")]//span', 'Rang 2'); + } +} + + + + +class TemplatesDispatchAbonneLargeNumberOfHoldsTest extends TemplatesIntonationAccountTestCase { + public function setUp(){ + parent::setUp(); + + $holds = []; + for ($i = 1 ; $i <=25 ; $i ++) + $holds [] = (new Class_WebService_SIGB_Reservation('12', + (new Class_WebService_SIGB_Exemplaire(999123 + $i)) + ->setTitre('Dobby') + ->setExemplaireOPAC(Class_Exemplaire::find(12089)))) + ->parseExtraAttributes(['Etat' => 'Réservation admise', + 'Rang' => '2', + 'Bibliotheque' => 'Tombouctou', + 'N° de notice' => 564]) + ->setAvailabilityEndDate('2020-06-06'); + + $this->_emprunteur + ->reservationsAddAll($holds); + + $this->dispatch('/opac/abonne/reservations/id_profil/72'); + } + + + /** @test */ + public function truncateListShouldHaveASizeOf20() { + $this->assertXPath('//div//select[contains(@title, "Limiter le nombre d")]//option[@value="20"]'); + } + + + /** @test */ + public function truncateListShouldHaveASizeOf40() { + $this->assertXPath('//div//select[contains(@title, "Limiter le nombre d")]//option[@value="40"]'); + } + + + /** @test */ + public function truncateListShouldHaveASizeOf100() { + $this->assertXPath('//div//select[contains(@title, "Limiter le nombre d")]//option[@value="100"]'); + } + + + /** @test */ + public function inputFiltrerShouldBePresent() { + $this->assertXPathContentContains('//form//label', 'Filtrer'); + } + + + /** @test */ + public function selectOnChangeShouldBePresent() { + $this->assertXPath('//select[contains(@onchange,"var container = $(")][contains(@onchange, "container.children().hide();var value=$(")][contains(@onchange, "val();container.children().not(\'.search_input_not_found\').slice(0, value).show()")]'); + } + + + /** @test */ + public function holdsShouldBeDisplaydInListGroup() { + $this->assertXPath('//div[contains(@class, "list-group")]//div[contains(@class, "list-group-item")]//div[contains(@class, "card")]'); + } + + + /** @test */ + public function scriptShouldContainsSearchInput() { + $this->assertXPathContentContains('//script', '.search_input('); + } + + + /** @test */ + public function scriptShouldContainsChildrenSliceShow() { + $this->assertXPathContentContains('//script', 'setTimeout(function() {container.children().slice(0, 20).show();'); + } } + class TemplatesDispatchAbonneSelectionsTest extends TemplatesIntonationAccountTestCase { /** @test */ public function selectionMesBDShouldBeDisplay() { diff --git a/tests/scenarios/Templates/TemplatesSearchTest.php b/tests/scenarios/Templates/TemplatesSearchTest.php index c8e4a38d8a10d59224c1fdbfc25993c039cc24c0..47edbebe96030cacb0967af110ee9b522d1e553b 100644 --- a/tests/scenarios/Templates/TemplatesSearchTest.php +++ b/tests/scenarios/Templates/TemplatesSearchTest.php @@ -136,6 +136,12 @@ class TemplatesDispatchIntonationSearchTest extends TemplatesIntonationTestCase public function linkToDeleteFacetShoulContainsMultifacetT3() { $this->assertXPathContentContains('//div[@class="criteres_recherche"]//a[@href="/recherche/simple/expressionRecherche/pomme/multifacets/T1"]', 'Site:'); } + + + /** @test */ + public function facetsSlideToggleScriptShouldBePresent() { + $this->assertXPathContentContains('//script', '$(function(){$(".facets .msg > a").click(function(e){ e.preventDefault();var anchor = $(this);anchor.next("ul").find("li").hide().appendTo(anchor.parent().closest("ul")).slideToggle();anchor.parent().remove();})});'); + } } @@ -230,7 +236,7 @@ class TemplatesSearchViewRecordTest extends TemplatesIntonationTestCase { /** @test */ public function shouldBeANovelty() { - $this->assertXPathContentContains('//a[contains(@href, "/nouveaute/1")]', 'Nouveauté'); + $this->assertXPathContentContains('//a[contains(@href, "/nouveaute/maintenant")]', 'Nouveauté'); } @@ -348,7 +354,7 @@ class TemplatesSearchDispatchIntonationSearchListFormatWallTest extends Template $sql = $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(POMME POMMES POM)' IN BOOLEAN MODE)) and type=1 order by alpha_auteur desc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(POMME POMMES POM)' IN BOOLEAN MODE)) and type=1 order by alpha_auteur desc", true, false) ->answers([[89, 'M87'], [99, 'A43']]) @@ -670,8 +676,8 @@ abstract class TemplatesSearchDispatchTest extends AbstractControllerTestCase { public function setUp() { parent::setUp(); $this->_buildTemplateProfil( - ['id' => 5, - 'template' => 'CHILI']); + ['id' => 5, + 'template' => 'CHILI']); $records = [$this->fixture('Class_Notice', ['id' => 89]), @@ -751,4 +757,47 @@ class TemplatesSearchDispatchWithArticlesIndexedTest extends TemplatesSearchDisp public function linkToBonjourLesTerriensShouldBeCmsArticleViewId34() { $this->assertXPath('//main//div[contains(@class,"search_records_col")]//a[contains(@href, "/cms/articleview/expressionRecherche/solaire/id_profil/5/id/34")]'); } -} \ No newline at end of file +} + + + + + +class TemplatesSearchDispatchWithNouveauteNowParamTest extends AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + $this->_buildTemplateProfil(['id' => 8987]); + + $time_source = new TimeSourceForTest('2021-01-13'); + Class_MoteurRecherche::setTimeSource($time_source); + Class_Notice::setTimeSource($time_source); + + $record = $this->fixture('Class_Notice', + ['id' => 89, + 'date_creation' => '2021-02-01' + ]); + + $sql = $this->mock() + ->whenCalled('fetchAll') + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(POMME POMMES POM)' IN BOOLEAN MODE) and date_creation >'2021-01-13') and type=1 order by (MATCH(titres) AGAINST(' POMME') * 1.5) + (MATCH(auteurs) AGAINST(' POMME')) desc", + true, + false) + ->answers([[89 ]]) + ; + + Zend_Registry::set('sql', $sql); + + $this->dispatch('/opac/recherche/simple/expressionRecherche/pomme/id_profil/72/nouveaute/maintenant/id_profil/8987'); + } + + + /** @test */ + public function linkWithNouveauteMaintantShouldBeDisplayedInRecord89() { + $this->assertXPathContentContains('//div[@id="89"]/following-sibling::div//a[contains(@href, "nouveaute/maintenant")]//span', 'Nouveauté'); + } +} diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index c6a11c1bcfd6b80cb2e23de92a3b9bc083410818..e4c456852304291895c5de2044e5db9680dea231 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -227,8 +227,10 @@ class TemplatesControllerTryHistoricTest extends TemplatesEnabledTestCase { abstract class TemplatesIntonationTestCase extends TemplatesEnabledTestCase { + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); @@ -2117,7 +2119,7 @@ class TemplateSearchSavedSettingsTest extends TemplatesIntonationTestCase { $sql = $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(POMME POMMES POM)' IN BOOLEAN MODE)) and type=1 order by alpha_titre asc", + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(POMME POMMES POM)' IN BOOLEAN MODE)) and type=1 order by alpha_titre asc", true, false) ->answers([[89, ''], [99, '']]) @@ -2507,4 +2509,4 @@ class TemplatesFormulaireContactActionWithBibSelectorSettingCheckedTest public function bibSelectorShouldBePresent() { $this->assertXPath('//select[@name="bib_selector"]'); } -} \ No newline at end of file +} diff --git a/tests/scenarios/bookmarks/SearchTest.php b/tests/scenarios/bookmarks/SearchTest.php index 74ff43cc0f3acc4922fb3f60d2641ef7ca0f4417..c29d6857096b27eb3eeb57b812fd0fc8596b373a 100644 --- a/tests/scenarios/bookmarks/SearchTest.php +++ b/tests/scenarios/bookmarks/SearchTest.php @@ -499,7 +499,7 @@ class Bookmarks_SearchCosmogrammePhaseTest Zend_Registry::set('sql', $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(HARRY HARRYS ARI) +(POTTER POTTERS POT)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", true, false) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(HARRY HARRYS ARI) +(POTTER POTTERS POT)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", true, false) ->answers($result) ->beStrict()); @@ -669,7 +669,7 @@ class Bookmarks_SearchMailWithArticlePhaseTest Zend_Registry::set('sql', $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(HARRY HARRYS ARI) +(POTTER POTTERS POT)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", true, false) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(HARRY HARRYS ARI) +(POTTER POTTERS POT)' IN BOOLEAN MODE)) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", true, false) ->answers($result) ->beStrict()); @@ -821,7 +821,7 @@ class Bookmarks_SearchDiffLoggedTest extends AbstractControllerTestCase { Zend_Registry::set('sql', $this->mock() ->whenCalled('fetchAll') - ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey) AGAINST('+(HARRY HARRYS ARI) +(POTTER POTTERS POT)' IN BOOLEAN MODE) and clef_alpha in ('DROITDEVANT--ODAEIICHIRO-15-GLENAT-2013-1')) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", true, false) + ->with("select id_notice, facettes from notices Where (MATCH(titres, auteurs, editeur, collection, matieres, dewey, other_terms) AGAINST('+(HARRY HARRYS ARI) +(POTTER POTTERS POT)' IN BOOLEAN MODE) and clef_alpha in ('DROITDEVANT--ODAEIICHIRO-15-GLENAT-2013-1')) and type=1 order by (MATCH(titres) AGAINST(' HARRY POTTER') * 1.5) + (MATCH(auteurs) AGAINST(' HARRY POTTER')) desc", true, false) ->answers([[1888, '']]) ->beStrict()); @@ -850,4 +850,4 @@ class Bookmarks_SearchDiffLoggedTest extends AbstractControllerTestCase { public function noveltyAt20180207ShouldBePresent() { $this->assertXPathContentContains('//a[not(contains(@href, "bookmarked_search"))][not(contains(@href, "bookmarked_version"))]', 'Nouveautés du 07 février 2018'); } -} \ No newline at end of file +}