diff --git a/VERSIONS_HOTLINE/158760 b/VERSIONS_HOTLINE/158760 new file mode 100644 index 0000000000000000000000000000000000000000..7a23935824a79cba76e08df294dfc937b7027196 --- /dev/null +++ b/VERSIONS_HOTLINE/158760 @@ -0,0 +1 @@ + - correctif #158760 : Cosmogramme : correction du bon déroulement de la phase d'indexation des facettes sur les domaines lorsque ces derniers utilisent un formulaire personnalisé. \ No newline at end of file diff --git a/library/Class/Profil.php b/library/Class/Profil.php index de5bd9039b2a0fa16dfcfb3c00076cae66866add..f300ca7036cfc9504be243af4994904c54c92598 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -155,6 +155,13 @@ class ProfilLoader extends Storm_Model_Loader { ? $profil : null; } + + + public function reset() : void { + Class_Profil::clearCache(); + if ($profile = Class_Profil::getCurrentProfil()) + $profile->clearInstanceCache(); + } } diff --git a/library/Class/SearchForm.php b/library/Class/SearchForm.php index 62cb2c9d771a433d8fee6eff05d4aac14a6ae93f..3c9912e83e1daa1a04ef01e12ac2560f3b462be9 100644 --- a/library/Class/SearchForm.php +++ b/library/Class/SearchForm.php @@ -20,7 +20,6 @@ */ - class Class_SearchFormLoader extends Storm_Model_Loader { public function getMultiOptions($base=[]) { diff --git a/library/Class/SearchForm/Validator.php b/library/Class/SearchForm/Validator.php index 4260c710cd01b819c1bc17340887a0a0357ba415..59736d2f9c20c387249c0af0f2c6efecd71d7b63 100644 --- a/library/Class/SearchForm/Validator.php +++ b/library/Class/SearchForm/Validator.php @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +require_once __DIR__ . '/../../PhpParser/lib/bootstrap.php'; + use PhpParser\ParserFactory; use PhpParser\NodeTraverser; use PhpParser\Node; diff --git a/library/ZendAfi/Controller/Plugin/PhpParser.php b/library/ZendAfi/Controller/Plugin/PhpParser.php deleted file mode 100644 index 92a0253cfe074595d8b0f9b78efc01d165c8da18..0000000000000000000000000000000000000000 --- a/library/ZendAfi/Controller/Plugin/PhpParser.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** - * Copyright (c) 2012-2018, 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_Controller_Plugin_PhpParser extends Zend_Controller_Plugin_Abstract { - public function preDispatch(Zend_Controller_Request_Abstract $request) { - if (!Class_AdminVar::isCustomSearchFormEnabled()) - return; - - require_once __DIR__.'/../../../PhpParser/lib/bootstrap.php'; - } -} diff --git a/library/startup.php b/library/startup.php index ec7e4202c1b46bdd289c1cf7e4205b74fb254f8b..07641f6de3b9684ed0334f458ce923fd7a850c35 100644 --- a/library/startup.php +++ b/library/startup.php @@ -472,7 +472,6 @@ class Bokeh_Engine { ->registerPlugin(new ZendAfi_Controller_Plugin_InspectorGadget()) ->registerPlugin(new ZendAfi_Controller_Plugin_CnilConsent()) ->registerPlugin(new ZendAfi_Controller_Plugin_Redmine()) - ->registerPlugin(new ZendAfi_Controller_Plugin_PhpParser()) ->registerPlugin(new ZendAfi_Controller_Plugin_FeaturesTracking()) ->registerPlugin(new ZendAfi_Controller_Plugin_LastSearch()) ->registerPlugin(new ZendAfi_Controller_Plugin_XHProfile($this->_config)) diff --git a/tests/TearDown.php b/tests/TearDown.php index e7643e8e464327189940544df8fc4cac5b4bd636..7705314e3c8a044267a8af8a0d172aa3d76eeb84 100644 --- a/tests/TearDown.php +++ b/tests/TearDown.php @@ -74,8 +74,7 @@ class TearDown { Class_Notice_Facette::reset(); Class_StatsNotices::setTimeSource(null); - Class_Profil::getCurrentProfil()->clearInstanceCache(); - Class_Profil::clearCache(); + Class_Profil::reset(); Class_ScriptLoader::resetInstance(); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b461b1b7b88a43c493a2823f9b5a0629b2d3446c..8113469f92765e3be59f9c8eacdeface1e752864 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -64,7 +64,6 @@ $_SERVER['HTTP_HOST'] = 'localhost'; setupOpac(); Class_ICal_Autoloader::getInstance()->ensureAutoload(); -require_once __DIR__ . '/../library/PhpParser/lib/bootstrap.php'; (new Storm_Cache())->getCache()->setOption('caching', true); diff --git a/tests/scenarios/DynamicFacetOnDomains/DynamicFacetOnDomainsPhaseTest.php b/tests/scenarios/DynamicFacetOnDomains/DynamicFacetOnDomainsPhaseTest.php index 78481d3d53f7927c835ae6b763cae3e8a0f579eb..59f8adafe5ac4dff860f0ad9874e967d04574929 100644 --- a/tests/scenarios/DynamicFacetOnDomains/DynamicFacetOnDomainsPhaseTest.php +++ b/tests/scenarios/DynamicFacetOnDomains/DynamicFacetOnDomainsPhaseTest.php @@ -202,3 +202,65 @@ class DynamicFacetOnDomainsPhaseDisabledTest extends DynamicFacetOnDomainsPhaseT $this->assertLogContains('Les facettes dynamiques sur les domaines ne sont pas activées'); } } + + + + +class DynamicFacetOnDomainsPhaseWithCustomFormTest extends DynamicFacetOnDomainsPhaseTest { + protected function _prepareFixtures() { + parent::_prepareFixtures(); + + Class_AdminVar::set('ENABLE_FACETS_ON_DOMAINS', 1); + Class_AdminVar::set('CUSTOM_DOMAIN_FORM', 1); + Class_AdminVar::set('CUSTOM_SEARCH_FORM', 1); + + $this->fixture(Class_SearchForm::class, + ['id' => 2, + 'label' => 'My super form', + 'filename' => __DIR__ . '/my_super.php']); + + $custom_values = ['type_doc' => 'testing']; + + $this->fixture(Class_Catalogue::class, + ['id' => 6, + 'libelle' => 'Adultes', + 'description' => 'Mon catalogue', + 'oai_spec' => 'adultes', + 'type_doc' => '1;3;4;5', + 'annee_debut' => 2012, + 'annee_fin' => 2012, + 'annexe' => 0, + 'dewey' => 78308, + 'sous_domaines' => [], + 'bibliotheque' => 1, + 'paniers' => [], + 'custom_form_id' => 2, + 'custom_form_values' => json_encode($custom_values)]); + + $this->fixture(Class_CodifThesaurus::class, + ['id' => 1, + 'code' => Class_CodifThesaurusFixed::CODE_DOMAIN_FACET, + 'id_thesaurus' => 'ANIM', + 'libelle' => 'Animaux', + 'libelle_facette' => 'Les animaux', + 'rule_list_domain_id' => ['6'] + ]); + + $sql = $this->mock(); + Zend_Registry::set('sql', $sql); + $sql + ->whenCalled('query') + ->with('update notices set facettes = clean_spaces(REGEXP_REPLACE(facettes, "\\\\bHANIM[a-zA-Z0-9]*\\\\b", ""))') + ->answers(1) + + ->whenCalled('query') + ->with('update notices set facettes=concat(facettes," HANIM0001") Where (MATCH(facettes) AGAINST(\'+(Ttesting)\' IN BOOLEAN MODE)) and type=1') + ->answers(1); + } + + + /** @test */ + public function logShouldContainsIndexationDomaineAdultes() { + $this->assertLogContains('Indexation des notices du domaine : Adultes'); + } +} diff --git a/tests/scenarios/DynamicFacetOnDomains/my_super.php b/tests/scenarios/DynamicFacetOnDomains/my_super.php new file mode 100644 index 0000000000000000000000000000000000000000..a7dbe8c7dca2cc83c617c040e0963ecf6cd59138 --- /dev/null +++ b/tests/scenarios/DynamicFacetOnDomains/my_super.php @@ -0,0 +1,2 @@ +<?php +$form->addElement('select', 'type_doc', []); \ No newline at end of file