diff --git a/VERSIONS b/VERSIONS index f074c0caa8bdec9337ff9bf4d3d78d0319cc7ea5..9e841af4fd3f871fdc791aed0d6015cdb5cec774 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,14 @@ +08/06/2017 - v7.9.22 + + - ticket #60504 : Indexation : correction de la facette emplacement + + - ticket #52000 : Recherche avancée : le critère genre apparait dans le résultat de recherche, permettant de le déselectionner + + - ticket #61144 : Administration : corrections de certains liens brisés pour les Bokeh ne disposant pas d'un nom de domaine dédié + + - ticket #60903 : Sélection d'une date dans le calendrier > le jour est remplacé par "dd" + + 06/06/2017 - v7.9.21 - ticket #40971 : Nanook : Pouvoir prendre l'email comme identifiant alternatif de l'abonné. diff --git a/cosmogramme/sql/patch/patch_328.php b/cosmogramme/sql/patch/patch_328.php new file mode 100644 index 0000000000000000000000000000000000000000..7ff9ec0ec9ee9e7c27e6292dc41d3d9767e8734d --- /dev/null +++ b/cosmogramme/sql/patch/patch_328.php @@ -0,0 +1,2 @@ +<?php +(new Class_Migration_EditorFacetCodeBecomeW())->run(); diff --git a/library/Class/Codification.php b/library/Class/Codification.php index 125ad6f95dca5af28d37ceee7a2f98ca0208ee95..d2a6b8a2b890036c6265cffd36c550040e665860 100644 --- a/library/Class/Codification.php +++ b/library/Class/Codification.php @@ -26,7 +26,7 @@ * B: bib * C: collection * D: dewey - * E: éditeur + * E: emplacement * F: centre intérêt * G: genre * H: thésaurus @@ -44,7 +44,7 @@ * T: type de doc * U: * V: disponibilité - * W: + * W: éditeur * X: * Y: annexe * Z: tag @@ -54,9 +54,9 @@ class Class_Codification { use Trait_Singleton, Trait_Translator; const - CHAMPS = 'JAKEFCNMDGHPILOR8Q', + CHAMPS = 'JAKEFCNMDGHPILOR8QW', CODE_COLLECTION = 'C', - CODE_EDITEUR = 'E', + CODE_EDITEUR = 'W', CODE_IDENTIFIANT = 'I', CODE_TITRE = 'J', CODE_COLLATION = 'K', @@ -120,30 +120,31 @@ class Class_Codification { return; $this->_nom_champs = - [Class_CodifAuteur::CODE_FACETTE => [ $this->_("Auteur"), $this->_( "Auteur(s)")], - Class_Bib::CODE_FACETTE => [ $this->_("Bibliothèque"), $this->_("Bibliothèque(s)")], - Class_Codification::CODE_COLLECTION => [ $this->_("Collection"), $this->_("Collection(s)")], - Class_CodifDewey::CODE_FACETTE => [ $this->_("Livres et Vidéos"), $this->_("Livres et Vidéos")], - Class_Codification::CODE_EDITEUR => [ $this->_("Editeur"), $this->_("Editeur(s)")], - Class_CodifCentreInteret::CODE_FACETTE => [ $this->_("Centre d'intérêt"), $this->_("Centre(s) d'intérêt")], - Class_CodifGenre::CODE_FACETTE => [ $this->_("Genre"), $this->_("Genre")], - Class_Codification::CODE_IDENTIFIANT => [ $this->_("Identifiant"), $this->_("Identifiant")], - Class_Codification::CODE_TITRE => [ $this->_("Titre"), $this->_("Titre(s)")], - Class_Codification::CODE_COLLATION => [ $this->_("Collation"), $this->_("Collation")], - Class_CodifLangue::CODE_FACETTE => [ $this->_("Langue"), $this->_("Langue(s)")], - Class_CodifMatiere::CODE_FACETTE => [ $this->_("Sujet"), $this->_("Sujet(s)")], + [Class_CodifAuteur::CODE_FACETTE => [ $this->_("Auteur"), $this->_( "Auteur(s)")], + Class_Bib::CODE_FACETTE => [ $this->_("Bibliothèque"), $this->_("Bibliothèque(s)")], + Class_Codification::CODE_COLLECTION => [ $this->_("Collection"), $this->_("Collection(s)")], + Class_CodifDewey::CODE_FACETTE => [ $this->_("Livres et Vidéos"),$this->_("Livres et Vidéos")], + Class_Codification::CODE_EDITEUR => [ $this->_("Editeur"), $this->_("Editeur(s)")], + Class_CodifCentreInteret::CODE_FACETTE => [ $this->_("Centre d'intérêt"),$this->_("Centre(s) d'intérêt")], + Class_CodifGenre::CODE_FACETTE => [ $this->_("Genre"), $this->_("Genre")], + Class_Codification::CODE_IDENTIFIANT => [ $this->_("Identifiant"), $this->_("Identifiant")], + Class_Codification::CODE_TITRE => [ $this->_("Titre"), $this->_("Titre(s)")], + Class_Codification::CODE_COLLATION => [ $this->_("Collation"), $this->_("Collation")], + Class_CodifLangue::CODE_FACETTE => [ $this->_("Langue"), $this->_("Langue(s)")], + Class_CodifMatiere::CODE_FACETTE => [ $this->_("Sujet"), $this->_("Sujet(s)")], Class_Codification::CODE_ANNEE => [ $this->_("Année"), $this->_("Année")], - Class_Codification::CODE_NOTES => [ $this->_("Notes"), $this->_("Notes")], - Class_CodifPcdm4::CODE_FACETTE => [ $this->_("Musique"), $this->_("Musique")], - Class_Codification::CODE_RESUME => [ $this->_("Résumé"), $this->_("Résumé")], - Class_CodifSection::CODE_FACETTE => [ $this->_("Section"), $this->_("Section")], - Class_TypeDoc::CODE_FACETTE => [ $this->_("Type de document"), $this->_("Types de documents")], - Class_CodifAnnexe::CODE_FACETTE => [ $this->_("Site"), $this->_("Site")], - Class_CodifTags::CODE_FACETTE => [ $this->_("Tag"), $this->_("Tag(s)")], - Class_Codification::CODE_URL => [ $this->_("Lien internet"), $this->_("Liens internet")], - Class_Codification::CODE_AVAILABILITY => [ $this->_("En rayon"), $this->_("En rayon")], + Class_Codification::CODE_NOTES => [ $this->_("Notes"), $this->_("Notes")], + Class_CodifPcdm4::CODE_FACETTE => [ $this->_("Musique"), $this->_("Musique")], + Class_Codification::CODE_RESUME => [ $this->_("Résumé"), $this->_("Résumé")], + Class_CodifSection::CODE_FACETTE => [ $this->_("Section"), $this->_("Section")], + Class_TypeDoc::CODE_FACETTE => [ $this->_("Type de document"),$this->_("Types de documents")], + Class_CodifAnnexe::CODE_FACETTE => [ $this->_("Site"), $this->_("Site")], + Class_CodifTags::CODE_FACETTE => [ $this->_("Tag"), $this->_("Tag(s)")], + Class_Codification::CODE_URL => [ $this->_("Lien internet"), $this->_("Liens internet")], + Class_Codification::CODE_AVAILABILITY => [ $this->_("En rayon"), $this->_("En rayon")], Class_Codification::CODE_NOUVEAUTE => [ $this->_("Nouveauté"), $this->_("Nouveauté")], - Class_Codification::CODE_PRIX => [ $this->_("Prix"), $this->_("Prix")]]; + Class_Codification::CODE_PRIX => [ $this->_("Prix"), $this->_("Prix")], + Class_CodifEmplacement::CODE_FACETTE => [ $this->_('Emplacement'), $this->_('Emplacement')]]; $this->addThesauriToNomChamps(); $this->setFacetDisplayNames(); @@ -258,14 +259,15 @@ class Class_Codification { if(!$notice) return ''; - $message = 'Voir tous les tomes'; + $me = new static(); + $message = $me->_('Voir tous les tomes'); switch ($notice->getTypeDoc()) { case Class_TypeDoc::PERIODIQUE: - $message = 'Voir tous les numéros'; + $message = $me->_('Voir tous les numéros'); break; case Class_TypeDoc::DVD: - $message = 'Voir tous les épisodes'; + $message = $me->_('Voir tous les épisodes'); break; } @@ -281,7 +283,7 @@ class Class_Codification { } - public function cleanDeletedFacets($concat_facets) { + public function cleanDeletedFacets($concat_facets) { $codes = []; $facets = $this->getCodesLibellesFacette($concat_facets); foreach ($facets as $facet) { @@ -293,4 +295,101 @@ class Class_Codification { return implode(';', $codes); } + + + public function getCodesFor($type) { + if ('libelles' == $type) + return $this->getNomChamp('tous'); + + if ('liste' == $type) + return $this->getCodesForList(); + + if ('facettes' == $type) + return $this->getCodesForFacets(); + + if ('tags' == $type) + return $this->getCodesForTags(); + + if ('champs' == $type) + return $this->getCodesForFields(); + + if (in_array($type, ['type_tags', 'champs_tags'])) + return $this->getCodesForTypeOrFieldTags(); + + return []; + } + + + public function getCodesForList() { + return [static::CODE_TITRE, + Class_TypeDoc::CODE_FACETTE, + Class_CodifAuteur::CODE_FACETTE, + static::CODE_ANNEE, + static::CODE_EDITEUR, + static::CODE_COLLECTION, + static::CODE_RESUME, + static::CODE_NOUVEAUTE, + Class_CodifCentreInteret::CODE_FACETTE, + static::CODE_URL]; + } + + + public function getCodesForFacets() { + $facets = [Class_CodifAuteur::CODE_FACETTE, + Class_CodifCentreInteret::CODE_FACETTE, + Class_CodifMatiere::CODE_FACETTE, + Class_CodifEmplacement::CODE_FACETTE, + Class_CodifDewey::CODE_FACETTE, + Class_CodifPcdm4::CODE_FACETTE, + Class_CodifLangue::CODE_FACETTE, + Class_CodifGenre::CODE_FACETTE, + Class_CodifSection::CODE_FACETTE, + Class_Bib::CODE_FACETTE, + Class_CodifAnnexe::CODE_FACETTE, + Class_CodifTags::CODE_FACETTE, + static::CODE_AVAILABILITY]; + + return array_merge($facets, + Class_CodifThesaurus::getFacettesIndex()); + } + + + public function getCodesForFields() { + return [Class_TypeDoc::CODE_FACETTE, + static::CODE_TITRE, + Class_CodifAuteur::CODE_FACETTE, + Class_CodifMatiere::CODE_FACETTE, + Class_CodifDewey::CODE_FACETTE, + Class_CodifPcdm4::CODE_FACETTE, + Class_CodifLangue::CODE_FACETTE, + Class_CodifGenre::CODE_FACETTE, + Class_CodifSection::CODE_FACETTE, + Class_Bib::CODE_FACETTE, + static::CODE_EDITEUR, + static::CODE_COLLECTION, + static::CODE_ANNEE, + static::CODE_RESUME, + static::CODE_NOUVEAUTE, + Class_CodifCentreInteret::CODE_FACETTE]; + } + + + public function getCodesForTags() { + return [Class_CodifAuteur::CODE_FACETTE, + Class_CodifCentreInteret::CODE_FACETTE, + Class_CodifMatiere::CODE_FACETTE, + Class_CodifDewey::CODE_FACETTE, + Class_CodifPcdm4::CODE_FACETTE, + Class_CodifTags::CODE_FACETTE]; + } + + + public function getCodesForTypeOrFieldTags() { + return [Class_CodifAuteur::CODE_FACETTE, + Class_CodifMatiere::CODE_FACETTE, + Class_CodifDewey::CODE_FACETTE, + Class_CodifPcdm4::CODE_FACETTE, + Class_CodifTags::CODE_FACETTE, + Class_CodifAnnexe::CODE_FACETTE]; + } } \ No newline at end of file diff --git a/library/Class/CriteresRecherche.php b/library/Class/CriteresRecherche.php index 7486f8d6c120230d56ca0bc172f7b43f5a559785..e1ec6c16b901c7ae7d876d9f9753ec4ca7490dd7 100644 --- a/library/Class/CriteresRecherche.php +++ b/library/Class/CriteresRecherche.php @@ -225,7 +225,7 @@ class Class_CriteresRecherche { public function getMultiFacets() { - return explode('-', $this->getParam('multifacets', '')); + return array_filter(explode('-', $this->getParam('multifacets',''))); } @@ -253,7 +253,11 @@ class Class_CriteresRecherche { public function getFiltres() { - $filtres = ['G' => $this->selectionToArray('G', $this->getGenre())]; + $model = new Class_Notice_Facette(Class_CodifGenre::CODE_FACETTE); + $model->getRubrique()->setParamName('genre'); + + $filtres = [$this->selectionToArray(Class_CodifGenre::CODE_FACETTE, + $this->getGenre())]; if (!$this->isRecherchePanier() && !$this->isRechercheCatalogueEmpty() @@ -271,7 +275,7 @@ class Class_CriteresRecherche { if (($codes = array_filter(explode(';',$filtre_str), [$this, 'validCodeOrNull'])) && ($key = Class_Notice_Facette::extractCodeRubrique($codes[0]))) $filtres[$key] = $codes; - } + } if ($bibs = $this->getBibs()) { $bib_ids=[]; diff --git a/library/Class/Migration/EditorFacetCodeBecomeW.php b/library/Class/Migration/EditorFacetCodeBecomeW.php new file mode 100644 index 0000000000000000000000000000000000000000..27a078403abfdb4b90d2c274e50d4404292525a0 --- /dev/null +++ b/library/Class/Migration/EditorFacetCodeBecomeW.php @@ -0,0 +1,109 @@ +<?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 Class_Migration_EditorFacetCodeBecomeW { + protected $_should_save = false; + + public function run() { + foreach(Class_Profil::findTopProfils() as $profil) + $this->runOne($profil); + } + + + protected function runOne($profil) { + $this->_should_save = false; + + $config = $profil->getCfgModulesAsArray(); + $config = $this->handleSimpleResult($config); + $config = $this->handleRecordView($config); + + if ($this->_should_save) + $profil->setCfgModules($config)->save(); + } + + + protected function handleSimpleResult($config) { + if (!array_key_exists('recherche', $config)) + return $config; + + if (!array_key_exists('resultatsimple', $config['recherche'])) + return $config; + + if (!array_key_exists('liste_codes', $config['recherche']['resultatsimple'])) + return $config; + + $current = $config['recherche']['resultatsimple']['liste_codes']; + $new = $this->handleFacetsList($current); + + if ($current == $new) + return $config; + + $config['recherche']['resultatsimple']['liste_codes'] = $new; + $this->_should_save = true; + + return $config; + } + + + protected function handleRecordView($config) { + if (!array_key_exists('recherche', $config)) + return $config; + + foreach($config['recherche'] as $k => $v) + $config['recherche'][$k] = $this->handleRecordViewType($k, $v); + + return $config; + } + + + protected function handleRecordViewType($key, $config) { + if ('viewnotice' != substr($key, 0, 10)) + return $config; + + if (!array_key_exists('entete', $config)) + return $config; + + $current = $config['entete']; + $new = $this->handleFacetsList($current); + + if ($current == $new) + return $config; + + $config['entete'] = $new; + $this->_should_save = true; + + return $config; + } + + + protected function handleFacetsList($values) { + $facets = new Storm_Collection(Class_Notice_RubriqueFacette::parseRubriquesFromPreferenceField($values)); + + return implode(';', + $facets + ->collect(function($facet) + { + return 'E' == $facet->getCode() ? 'W' : $facet->getCode(); + }) + ->getArrayCopy()); + } +} diff --git a/library/Class/Notice/RubriqueFacette.php b/library/Class/Notice/RubriqueFacette.php index 73d76e3e9c224963a8f7844b17c5b532f5af4d97..0f6a87fe668a8fa6e30bbaaf00d14a5a55a37826 100644 --- a/library/Class/Notice/RubriqueFacette.php +++ b/library/Class/Notice/RubriqueFacette.php @@ -23,7 +23,8 @@ class Class_Notice_RubriqueFacette { protected $_code, - $_libelle; + $_libelle, + $_param_name; public static function find($code) { if (isset(static::$_instances[$code])) @@ -38,6 +39,17 @@ class Class_Notice_RubriqueFacette { } + public function setParamName($name) { + $this->_param_name=$name; + return $this; + } + + + public function getParamName() { + return $this->_param_name; + } + + public static function parseRubriquesFromPreferenceField($facets_codes) { if (!$facets_codes) return []; diff --git a/library/Class/Systeme/ModulesAppli.php b/library/Class/Systeme/ModulesAppli.php index 775f2ea0f92ce59a316962a9c0010166aa262ec7..23277476c55a421c740d8fa572beda20a145b15e 100644 --- a/library/Class/Systeme/ModulesAppli.php +++ b/library/Class/Systeme/ModulesAppli.php @@ -334,7 +334,10 @@ class Class_Systeme_ModulesAppli extends Class_Systeme_ModulesAbstract { $ret["titre"] = "Recherche avancée"; // Titre de la boite $ret["select_bib"] = 1; // Afficher le lien de sélection des bibliothèques $ret["liste_nb_par_page"] = 10; // Nombre de notices par page - $ret["liste_codes"] = 'TAE'; // Champs à afficher + $ret["liste_codes"] = implode(';', + [Class_TypeDoc::CODE_FACETTE, + Class_CodifAuteur::CODE_FACETTE, + Class_Codification::CODE_EDITEUR]); // Champs à afficher break; case "guidee": $ret["barre_nav"] = "Recherche guidée"; // Barre de nav @@ -347,7 +350,10 @@ class Class_Systeme_ModulesAppli extends Class_Systeme_ModulesAbstract { case 'viewnotice': $ret = ['barre_nav' => 'Notice', // Barre de nav - 'entete' => 'ECN', // Champs a afficher dans l'entete + 'entete' => implode(';', + [Class_Codification::CODE_EDITEUR, + Class_Codification::CODE_COLLECTION, + Class_Codification::CODE_ANNEE]), // Champs a afficher dans l'entete 'analytics' => '', 'analytics_title' => '', 'analytics_authors' => '', diff --git a/library/Class/Url.php b/library/Class/Url.php index 7344b9041fcfacb47e3bb1a491a986d28237ad3c..5ed6e43ca1d7f8ad16fa183f8f789bbe5ab4cfb1 100644 --- a/library/Class/Url.php +++ b/library/Class/Url.php @@ -125,6 +125,13 @@ class Class_Url { } + public static function relative($url_array_or_string, $name=null, $reset=true) { + return is_array($url_array_or_string) + ? static::assemble($url_array_or_string, $name, $reset) + : static::prependBaseUrl($url_array_or_string); + } + + /** * Generates an url given the name of a route. * @@ -146,15 +153,20 @@ class Class_Url { } + public static function prependBaseUrl($url) { + if ((!static::$_do_not_add_base_url) && BASE_URL && (0 !== strpos($url, BASE_URL))) + $url = BASE_URL . ($url[0] == '/' ? $url : '/'.$url); + + return ($url[0] == '/' ? $url : '/'.$url); + } + + public function absoluteUrl($url_array_or_string = [], $name = null, $reset = false, $encode = true) { $url = $this->prepare($url_array_or_string, $name, $reset, $encode); if (preg_match('/http[s]?:\/\//', $url)) return $url; - if ((!static::$_do_not_add_base_url) && BASE_URL && (0 !== strpos($url, BASE_URL))) - $url = BASE_URL . ($url[0] == '/' ? $url : '/'.$url); - - $url = ($url[0] == '/' ? $url : '/'.$url); + $url = static::prependBaseUrl($url); return static::rootUrl() . $url; } @@ -173,6 +185,3 @@ class Class_Url { return static::assemble($url_array_or_string, $name, $reset, $encode); } } - - -?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/TagSelectionChamps.php b/library/ZendAfi/View/Helper/Admin/TagSelectionChamps.php index 0ed2bdb6ae647ac531705541f3b51a1220d19cb1..4d47a5308c2c9e5f33285b38cabf9fde8c9df7be 100644 --- a/library/ZendAfi/View/Helper/Admin/TagSelectionChamps.php +++ b/library/ZendAfi/View/Helper/Admin/TagSelectionChamps.php @@ -31,26 +31,7 @@ class ZendAfi_View_Helper_Admin_TagSelectionChamps extends ZendAfi_View_Helper_B protected function getAvailableFieldsFor($heading) { - if ('libelles' == $heading) - return (new Class_Codification)->getNomChamp('tous'); - - if ('liste' == $heading) - return ['J', 'T', 'A', 'N', 'E', 'C', 'R', '9', 'F', '8']; - - if ('facettes' == $heading) - return array_merge(['A', 'F', 'M', 'D', 'P', 'L', 'G', 'S', 'B', 'Y', 'Z', 'V'], - Class_CodifThesaurus::getFacettesIndex()); - - if ('tags' == $heading) - return ['A', 'F', 'M', 'D', 'P', 'Z']; - - if ('champs' == $heading) - return ['T', 'J', 'A', 'M', 'D', 'P', 'L', 'G', 'S', 'B', 'E', 'C', 'N', 'R', '9', 'F']; - - if (in_array($heading, ['type_tags', 'champs_tags'])) - return ['A', 'M', 'D', 'P', 'Z', 'Y']; - - return []; + return (new Class_Codification())->getCodesFor($heading); } diff --git a/library/ZendAfi/View/Helper/DatePicker.php b/library/ZendAfi/View/Helper/DatePicker.php index bf4121073fddd95b695becce85c1fa67c7ef5f10..82cdd20f8d53ba1bfeb0452f926f18c153e9f500 100644 --- a/library/ZendAfi/View/Helper/DatePicker.php +++ b/library/ZendAfi/View/Helper/DatePicker.php @@ -29,7 +29,7 @@ class ZendAfi_View_Helper_DatePicker extends ZendAfi_View_Helper_BaseHelper { public function datePicker($name, $varDate, $dateOnly=true, $allDaySwitch='',$disabled=false) { $locale = Zend_Registry::get('locale'); - $optionsdateonly = $optionswithhours = ['dateFormat' => 'dd/MM/YYYY', + $optionsdateonly = $optionswithhours = ['dateFormat' => 'DD/MM/YYYY', 'locale' => substr($locale,0,2), 'firstDayOfWeek' => 1, 'minuteInterval' => 15, @@ -37,7 +37,7 @@ class ZendAfi_View_Helper_DatePicker extends ZendAfi_View_Helper_BaseHelper { 'autodateOnStart' => false, 'dateOnly' => true]; - $optionswithhours['dateFormat'] = 'dd/MM/YYYY hh:mm'; + $optionswithhours['dateFormat'] = 'DD/MM/YYYY hh:mm'; $optionswithhours['dateOnly'] = false; $optionswithhours['minuteInterval'] = 15; diff --git a/library/ZendAfi/View/Helper/RenderModelActions.php b/library/ZendAfi/View/Helper/RenderModelActions.php index 531b78c7189eef5d8a834a163a70ac0fe57f9483..b2427484d50211c40c3d95bdd769406a28b85606 100644 --- a/library/ZendAfi/View/Helper/RenderModelActions.php +++ b/library/ZendAfi/View/Helper/RenderModelActions.php @@ -151,9 +151,11 @@ class ZendAfi_View_Helper_RenderModelAction { if(!$url = $this->_conf[self::URL]) return ''; - return is_array($url) - ? Class_Url::assemble($this->_injectIdIn($id, $url), null, false) + $url = is_array($url) + ? $this->_injectIdIn($id, $url) : $this->_injectId($id, $url); + + return Class_Url::relative($url, null, false); } diff --git a/library/ZendAfi/View/Helper/TagCriteresRecherche.php b/library/ZendAfi/View/Helper/TagCriteresRecherche.php index ca30635ececabd3cd7fab8a879e209eb1a4f8c80..6825bdbf09ede307692bdbd2b4a16449c57d9d30 100644 --- a/library/ZendAfi/View/Helper/TagCriteresRecherche.php +++ b/library/ZendAfi/View/Helper/TagCriteresRecherche.php @@ -163,6 +163,25 @@ class ZendAfi_View_Helper_TagCriteresRecherche extends ZendAfi_View_Helper_BaseH } + public function visitFiltre($filtre) { + $libelle=[]; + + foreach ($filtre as $facet) { + $model = new Class_Notice_Facette($facet); + $key = $model->getRubrique()->getCode(); + $libelle[] = $model->getLibelleFacette(); + } + + $label = $model->getCodeRubriqueLibelle() . ': ' + . implode($this->_(' OU '), $libelle); + + $url = $this->_criteres_recherche + ->getUrlCriteresWithoutElement($model->getRubrique()->getParamName()); + + $this->htmlAppend($this->getSuppressionImgUrlForLibelle($label, $url)); + } + + public function visitMultiFacet($facet) { if (!$facet) return; @@ -172,6 +191,7 @@ class ZendAfi_View_Helper_TagCriteresRecherche extends ZendAfi_View_Helper_BaseH if (!isset($this->_multi_facets[$key])) $this->_multi_facets[$key] = ['label' => $model->getCodeRubriqueLibelle(), 'values' => []]; + $this->_multi_facets[$key]['values'][] = $model->getLibelleFacette(); } diff --git a/library/startup.php b/library/startup.php index 09193a989309537763f427ecdf1d0a2354c98e05..2b376b2500066074d1e94bc12fe92eafd6c13183 100644 --- a/library/startup.php +++ b/library/startup.php @@ -82,7 +82,7 @@ class Bokeh_Engine { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','7.9'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.21'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.22'); defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/'); diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index bd2cdf5cbb964824a9c85bb2982cc59b73108e5b..ad355308ab9c2a9e0378620b358d110b3e857a8f 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -412,7 +412,7 @@ class CmsControllerArticleConcertAsAdminPortailEditActionTest extends CmsControl /** @test */ public function datePickerJavascriptForDebutShouldBeDateOnlyTrue() { $this->assertXPathContentContains('//script', - 'input#debut").appendDtpicker({"dateFormat":"dd\/MM\/YYYY","locale":"fr","firstDayOfWeek":1,"minuteInterval":15,"closeOnSelected":"true","autodateOnStart":false,"dateOnly":true}'); + 'input#debut").appendDtpicker({"dateFormat":"DD\/MM\/YYYY","locale":"fr","firstDayOfWeek":1,"minuteInterval":15,"closeOnSelected":"true","autodateOnStart":false,"dateOnly":true}'); } @@ -437,7 +437,7 @@ class CmsControllerArticleConcertAsAdminPortailEditActionTest extends CmsControl /** @test */ public function datePickerJavascriptForEventDebutShouldBeDateOnlyFalse() { $this->assertXPathContentContains('//script', - 'input#events_debut").appendDtpicker({"dateFormat":"dd\/MM\/YYYY hh:mm","locale":"fr","firstDayOfWeek":1,"minuteInterval":15,"closeOnSelected":"true","autodateOnStart":false,"dateOnly":false}'); + 'input#events_debut").appendDtpicker({"dateFormat":"DD\/MM\/YYYY hh:mm","locale":"fr","firstDayOfWeek":1,"minuteInterval":15,"closeOnSelected":"true","autodateOnStart":false,"dateOnly":false}'); } @@ -2950,7 +2950,7 @@ class CmsControllerEditArticleWithDate30December2014Test extends CmsControllerte /** @test */ public function inputFinShouldContains30_12_2014() { - $this->assertXPath('//input[@name="fin"][@value="30/12/2014"]'); + $this->assertXPath('//input[@name="fin"][@value="30/12/2014"]', $this->_response->getBody()); } diff --git a/tests/application/modules/admin/controllers/ModulesControllerTest.php b/tests/application/modules/admin/controllers/ModulesControllerTest.php index 443a71b644f1ac53453d9c63fe28e8bf60d02761..6eb02519d5b6955c06f6805505d887998eff843e 100644 --- a/tests/application/modules/admin/controllers/ModulesControllerTest.php +++ b/tests/application/modules/admin/controllers/ModulesControllerTest.php @@ -599,20 +599,28 @@ class ModulesControllerConfigRechercheResultatTest /** @test */ - public function shouldDisplayDomainChoice() { - $this->assertXPath('//div[@data-heading="facettes"]//li[@data-id="HCCCC"]'); + public function listDisplayConfigShouldContainsFacetsEditor() { + $this->assertXPath('//div[@data-heading="liste"]//li[@data-id="W"]'); } - /** @test */ - public function shouldDisplayRootCustomFieldsChoice() { - $this->assertNotXPath('//div[@data-heading="facettes"]//li[@data-id="HCFCF"]'); + public function facetsData() { + return [['E'], ['HCCCC'], ['HCFCF0001'] ]; + } + + + /** + * @test + * @dataProvider facetsData + */ + public function facetDisplayShouldContainsDataCode($data_code) { + $this->assertXPath('//div[@data-heading="facettes"]//li[@data-id="' . $data_code . '"]'); } /** @test */ - public function shouldDisplayCustomPublicChoice() { - $this->assertXPath('//div[@data-heading="facettes"]//li[@data-id="HCFCF0001"][@data-label="Custom public"]'); + public function facetDisplayShouldNotContainsRootCustomFieldsChoice() { + $this->assertNotXPath('//div[@data-heading="facettes"]//li[@data-id="HCFCF"]'); } } diff --git a/tests/application/modules/admin/controllers/NewsletterControllerTest.php b/tests/application/modules/admin/controllers/NewsletterControllerTest.php index ce9caf9feca1e070d5929cfa308be382215f4b71..97964a0e22ead600a0266bcbfbdd77109b5c6689 100644 --- a/tests/application/modules/admin/controllers/NewsletterControllerTest.php +++ b/tests/application/modules/admin/controllers/NewsletterControllerTest.php @@ -140,7 +140,7 @@ class Admin_NewsletterControllerIndexActionTest extends Admin_NewsletterControll public function testEditNouveautesClassiqueLink() { - $this->assertXPath("//a[contains(@href, '/admin/newsletter/edit/id/1')]"); + $this->assertXPath("//a[contains(@href, '" . BASE_URL . "/admin/newsletter/edit/id/1')]"); } diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index b33436331fe17be0ad14f2fd6940fc879d228916..84a11c9d5909b3bccf1908154c1d7409ef3df6db 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -127,7 +127,7 @@ abstract class NoticeAjaxControllerNoticeSouleymaneTestCase extends AbstractCont parent::setUp(); Class_Profil::getCurrentProfil() - ->setCfgModules(['recherche' => ['resultatsimple' => ['liste_codes' => "TANECRG"]]]); + ->setCfgModules(['recherche' => ['resultatsimple' => ['liste_codes' => "TANWCRG"]]]); $this->fixture('Class_CodifAuteur', ['id' => 1, diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index e2b45d15f0d08cbd375d4a9338d7d4854e86eca4..38fc2eba626e73f8db4c03b6ab4913a2f1d119b8 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -319,7 +319,7 @@ class RechercheControllerViewNoticeWithPreferencesTest extends RechercheControll $preferences = [ 'barre_nav' => 'Document', - 'entete' =>"ABCDEFGIKLMNOPRSTtYZ8v9", + 'entete' =>"ABCDWFGIKLMNOPRSTtYZ8v9", 'onglets' => [ 'detail' => ['titre' => 'Details', 'aff' => '1', 'ordre' => 1, 'largeur' => 10], 'avis' => ['titre' => 'avis', 'aff' => '1', 'ordre' => 2, 'largeur' => 10], @@ -1486,7 +1486,7 @@ abstract class RechercheControllerSimpleActionListeFormatTestCase extends Abstra Class_Profil::getCurrentProfil() ->setCfgModules(['recherche' => ['resultatsimple' => [ 'liste_format' => $this->_liste_format , - 'liste_codes' => "TANECR", + 'liste_codes' => "TANWCR", 'liste_nb_par_page' => $this->_nb_par_page, 'search_term_editable' => $this->_search_term_editable]]]) ->setSelTypeDoc('1;2;3;4;5'); @@ -1702,6 +1702,10 @@ class RechercheControllerSimpleActionLibelleFacetteTest extends RechercheControl parent::setup(); Class_AdminVar::newInstanceWithId('FACETTE_AUTEUR_LIBELLE', ['valeur' => 'Les super auteurs']); Class_AdminVar::newInstanceWithId('FACETTE_DEWEY_LIBELLE', ['valeur' => 'DEWEY ?!@']); + $this->fixture('Class_CodifGenre', + ['id' => 19, + 'libelle' => 'Manga']); + $this->dispatch('/recherche/simple/?'. 'operateur_titres=and'. @@ -1722,6 +1726,7 @@ class RechercheControllerSimpleActionLibelleFacetteTest extends RechercheControl '&annee_fin='. '&nouveaute='. '&annexe='. + '&genre=1%3B19'. '§ion=', true); } @@ -1732,6 +1737,13 @@ class RechercheControllerSimpleActionLibelleFacetteTest extends RechercheControl } + /** @test */ + public function criteresRechercheShouldContainsGenreMangaOrSpectacle() { + $this->assertXPathContentContains('//div[@class="criteres_recherche"]//div//a[contains(@href,"/recherche/simple/rech_auteurs/musso/rech_dewey/pomme/tri/%2A/operateur_auteurs/and/operateur_dewey/and/type_recherche/fulltext")]', + 'Genre: spectacle OU Manga'); + } + + /** @test */ public function criteresRechercheShouldContainsDEWEY() { $this->assertXPathContentContains('//div[@class="criteres_recherche"]//div', 'DEWEY ?!@',$this->_response->getBody()); diff --git a/tests/db/UpgradeDBTest.php b/tests/db/UpgradeDBTest.php index 88ad6340d71575f2b8479404c298a1d143e333ea..9d97b00dbc5a2daace7361a791c2802dd16035e0 100644 --- a/tests/db/UpgradeDBTest.php +++ b/tests/db/UpgradeDBTest.php @@ -1502,4 +1502,35 @@ class UpgradeDB_327_Test extends UpgradeDBTestCase { $data = $this->query('select * from newsletter_dispatch where title="Title 2 for test" ;')->fetch(); $this->assertNull($data); } +} + + + +class UpgradeDB_328_Test extends UpgradeDBTestCase { + protected $_data; + + public function prepare() { + try { + $cfg = ['recherche' => ['resultatsimple' => ['liste_codes' => 'E;N;TEN'], + 'viewnotice1' => ['entete' => 'JAENFGM']]]; + $this->query("update bib_admin_profil set CFG_MODULES='" . serialize($cfg) . "' where id_profil=1"); + } catch(Exception $e) {} + Class_Profil::clearCache(); + } + + + public function setUp() { + parent::setUp(); + + $this->_data = $this + ->query('select CFG_MODULES from bib_admin_profil where id_profil=1;') + ->fetch()['CFG_MODULES']; + } + + + /** @test */ + public function editorFieldCodeShouldBecomeW() { + $this->assertContains('s:11:"liste_codes";s:7:"W;N;TEN";', $this->_data); + $this->assertContains('s:6:"entete";s:13:"J;A;W;N;F;G;M";', $this->_data); + } } \ No newline at end of file diff --git a/tests/library/Class/CodificationTest.php b/tests/library/Class/CodificationTest.php index 1432aecec66d4202789bacff5dec5d273646e739..4dde45a991548f0a6199d3c3eb729880b8c1b6d5 100644 --- a/tests/library/Class/CodificationTest.php +++ b/tests/library/Class/CodificationTest.php @@ -52,34 +52,35 @@ class CodificationNomChampsTest extends Storm_Test_ModelTestCase { $translate = Zend_Registry::get('translate'); $translate->setLocale('fr'); - return [ - - [ ['A'],[$translate->_("Auteur")]], - [ ['B'],[$translate->_('Bibliothèque')]], - [ ['C'],[$translate->_('Collection')]], - [ ['D'],["Bouquins"]], - [ ['E'],[$translate->_('Editeur')]], - [ ['F'],[$translate->_("Les centres d'intérêt")]], - [ ['G'],[$translate->_('Genre')]], - [ ['HGENR'],[$translate->_('Genre Electre')]], - [ ['HTHEM'],[$translate->_('Themes Electre')]], - [ ['HFDEL'],['']], - [ ['I'],[$translate->_('Identifiant')]], - [ ['K'],[$translate->_('Collation')]], - [ ['L'],[$translate->_('Langue')]], - [ ['M'],[$translate->_('Sujet')]], - [ ['N'],[$translate->_('Année')]], - [ ['O'],[$translate->_('Notes')]], - [ ['P'],["Scuds"]], - [ ['R'],[$translate->_('Résumé')]], - [ ['S'],[$translate->_('Section')]], - [ ['J'],[$translate->_('Titre')]], - [ ['T'],[$translate->_('Type de document')]], - [ ['V'],[$translate->_('En rayon')]], - [ ['Y'],[$translate->_('Site')]], - [ ['Z'],[$translate->_('Tag')]], - [ ['8'],[$translate->_('Lien internet')]], - [ ['9'],[$translate->_('Nouveauté')]], + return + [ + [ ['A'],[$translate->_("Auteur")]], + [ ['B'],[$translate->_('Bibliothèque')]], + [ ['C'],[$translate->_('Collection')]], + [ ['D'],["Bouquins"]], + [ ['E'],[$translate->_('Emplacement')]], + [ ['W'],[$translate->_('Editeur')]], + [ ['F'],[$translate->_("Les centres d'intérêt")]], + [ ['G'],[$translate->_('Genre')]], + [ ['HGENR'],[$translate->_('Genre Electre')]], + [ ['HTHEM'],[$translate->_('Themes Electre')]], + [ ['HFDEL'],['']], + [ ['I'],[$translate->_('Identifiant')]], + [ ['K'],[$translate->_('Collation')]], + [ ['L'],[$translate->_('Langue')]], + [ ['M'],[$translate->_('Sujet')]], + [ ['N'],[$translate->_('Année')]], + [ ['O'],[$translate->_('Notes')]], + [ ['P'],["Scuds"]], + [ ['R'],[$translate->_('Résumé')]], + [ ['S'],[$translate->_('Section')]], + [ ['J'],[$translate->_('Titre')]], + [ ['T'],[$translate->_('Type de document')]], + [ ['V'],[$translate->_('En rayon')]], + [ ['Y'],[$translate->_('Site')]], + [ ['Z'],[$translate->_('Tag')]], + [ ['8'],[$translate->_('Lien internet')]], + [ ['9'],[$translate->_('Nouveauté')]], ]; }