Skip to content
Snippets Groups Projects
Commit 0d819bd1 authored by efalcy's avatar efalcy
Browse files

dev $26550 : add facet Public for Nanook

parent 3b3045d6
Branches
Tags
2 merge requests!989Dev #26550 nanook public facet,!978Dev #26550 nanook public facet
<?php
error_reporting(E_ERROR | E_PARSE);
define("PATCH_LEVEL","259");
define("PATCH_LEVEL","260");
define("APPLI","cosmogramme");
define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs");
......
<?php
Class_CodifThesaurus::addFacetForSigb('Public' , '993$a',Class_IntBib::COM_NANOOK);
?>
......@@ -26,6 +26,17 @@ class Class_CodifThesaurusLoader extends Storm_Model_Loader {
}
public function addFacetForSigb($facet_name, $facet_rules, $comm_sigb) {
if (!Class_IntBib::findFirstBy(['comm_sigb' => $comm_sigb])
|| Class_CodifThesaurus::findFirstBy(['rules' => json_encode(['label' => $facet_rules])]))
return ;
$thesaurus = Class_CodifThesaurus::newInstance(['libelle' => $facet_name,
'libelle_facette' => $facet_name,
'rules' => json_encode(['label' => $facet_rules])]);
$thesaurus->save();
}
public function getLibelleHierarchique($enreg) {
if (!$enreg)
return '';
......
<?php
e<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
......@@ -80,4 +80,29 @@ class CodifThesaurusTest extends ModelTestCase {
$this->assertEquals('Culture : Spectacles : Conférences Gesticulées',Class_CodifThesaurus::getLibelleHierarchique(Class_CodifThesaurus::newInstanceWithId(10,['id_thesaurus'=>'THEM000100503000'])->setLibelle('Conférences Gesticulées')));
}
/** @test */
public function facetPublicShouldBeCreatedForNanook() {
Class_CodifThesaurus::beVolatile();
$this->fixture('Class_IntBib',
['id' => 1,
'comm_sigb' => Class_IntBib::COM_NANOOK,
'comm_params' => ['url_serveur' => 'http://bib.valensol.net']]);
Class_CodifThesaurus::addFacetForSigb('Public' , '993$a',Class_IntBib::COM_NANOOK);
$this->assertNotNull(Class_CodifThesaurus::findFirstBy(['libelle_facette' => 'Public']));
}
/** @test */
public function facetPublicShouldNotBeCreatedForNanook() {
Class_CodifThesaurus::beVolatile();
$this->fixture('Class_IntBib',
['id' => 1,
'comm_sigb' => Class_IntBib::COM_NANOOK,
'comm_params' => ['url_serveur' => 'http://bib.valensol.net']]);
Class_CodifThesaurus::addFacetForSigb('Publique' , '993$a',Class_IntBib::COM_NANOOK);
Class_CodifThesaurus::addFacetForSigb('Public' , '993$a',Class_IntBib::COM_NANOOK);
$this->assertNull(Class_CodifThesaurus::findFirstBy(['libelle_facette' => 'Public']));
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment