diff --git a/VERSIONS_WIP/30936 b/VERSIONS_WIP/30936 new file mode 100644 index 0000000000000000000000000000000000000000..58f809c3ff0ac44279dfd466e78bd6ffd3557fec --- /dev/null +++ b/VERSIONS_WIP/30936 @@ -0,0 +1 @@ + - ticket #30936 : Réalisation du développement permettant l'intégration des ressources numériques de CdScript avec génération du lien pour accéder à la ressource. \ No newline at end of file diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index 1d1c1a69cc5484bb338f32ec2d45c35f2b1980d4..16af1df81de0db388b2c6628285f0e49bf0de28a 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -111,7 +111,6 @@ class NoticeAjaxController extends Zend_Controller_Action { $exemplaires = $this->_loadExemplaire(["id_notice" => $notice_ids]); - foreach($exemplaires as $exemplaire) $exemplaire->updateAvailabilityFromSIGB() ->save(); @@ -121,8 +120,7 @@ class NoticeAjaxController extends Zend_Controller_Action { $notice->updateFacetsFromExemplaires() ->save(); - $this->getResponse()->setBody($this->view->Notice_Exemplaires($exemplaires, $nb_notices_oeuvre, $display)); - + $this->_sendResponseWithScripts($this->view->Notice_Exemplaires($exemplaires, $nb_notices_oeuvre, $display)); } public function exemplairesAction() { diff --git a/cosmogramme/php/_init.php b/cosmogramme/php/_init.php index 7c36ad9fabd761ccdfaec66108ced749a8a9f80d..684300cd54dc68c228e1d58ffe132b9d70824c57 100644 --- a/cosmogramme/php/_init.php +++ b/cosmogramme/php/_init.php @@ -1,7 +1,7 @@ <?php error_reporting(E_ERROR | E_PARSE); -define("PATCH_LEVEL","277"); +define("PATCH_LEVEL","278"); define("APPLI","cosmogramme"); define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs"); @@ -18,6 +18,7 @@ define('COM_ORPHEE', 8); define('COM_MICROBIB', 9); define('COM_BIBLIXNET', 10); define('COM_DYNIX', 11); +define('COM_CDSCRIPT', 12); $basePath = dirname(realpath(__FILE__)); set_include_path(get_include_path() diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 5f369c6f244c4e5007cbbe0d6e54ef2c1ac8b356..98576d3551056a1a67b6b59d2bc666d97ba4835b 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -113,7 +113,6 @@ class notice_integration { } $this->format=$format; unset($this->analyseur); - switch($format) { // Unimarc diff --git a/cosmogramme/php/fonctions/objets_saisie.php b/cosmogramme/php/fonctions/objets_saisie.php index 6566004dd600db17a3a66f0ad319e81e71affb90..dbf0bba28aaf0a54642cf97fcd05dd282a6c3f16 100644 --- a/cosmogramme/php/fonctions/objets_saisie.php +++ b/cosmogramme/php/fonctions/objets_saisie.php @@ -97,6 +97,11 @@ function getBlocsParams($id_bib, $type, $valeurs) { return getOuiNon($id, $valeur); }]]; + if(in_array($clef, [COM_CDSCRIPT])) + $champs_params[0] = ['server_url', + 'remote_library_id']; + + if (in_array($clef, [COM_VSMART, COM_MICROBIB, COM_BIBLIXNET])) $champs_params[0] = ['url_serveur']; diff --git a/cosmogramme/sql/patch/patch_275.php b/cosmogramme/sql/patch/patch_275.php index 037c4dddd9e20eaee63c5611f968f3b0785984d5..7ad78dd84dcec5a47d1aa06042acfc01c6894d7f 100644 --- a/cosmogramme/sql/patch/patch_275.php +++ b/cosmogramme/sql/patch/patch_275.php @@ -1,4 +1,4 @@ <?php $adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $adapter->query("ALTER TABLE bib_admin_users MODIFY pseudo varchar(100) NULL default ''"); -?> \ No newline at end of file +?> diff --git a/cosmogramme/sql/patch/patch_278.php b/cosmogramme/sql/patch/patch_278.php new file mode 100644 index 0000000000000000000000000000000000000000..8b33a4ae5a4ca824fc2062961fd2e096b1412fef --- /dev/null +++ b/cosmogramme/sql/patch/patch_278.php @@ -0,0 +1,11 @@ +<?php +$adapter = Zend_Db_Table::getDefaultAdapter(); + +try { + $adapter->query("update variables set liste='0:Pas informatisé\r\n1:Pergame\r\n2:Paprika\r\n3:Orphée\r\n4:Opsys\r\n5:Microbib\r\n6:Atalante\r\n7:Multilis\r\n8:Bibal\r\n9:Milord\r\n10:Elissa\r\n11:v-smart\r\n12:Koha\r\n13:Nanook\r\n14:Carthame\r\n15:Dynix\r\n16:Cd-Script\r\n' where clef='sigb';"); +} catch (Exception $e) {} + +try { + $adapter->query("update variables set liste='0:aucun\r\n1:pergame\r\n2:web-service Opsys\r\n3:serveur Z39.50\r\n4:web-service V-Smart\r\n5:web-service Koha\r\n6:web-service Carthame\r\n7:web-service AFI-Nanook\r\n8:web-service Orphée\r\n9:web-service Microbib\r\n10:web-service BiblixNet\r\n11:web-service Dynix-Symphony\r\n12:Cd-Script\r\n' where clef='comm_sigb';"); +} catch (Exception $e) {} +?> diff --git a/cosmogramme/tests/php/classes/CdScriptIntegrationTest.php b/cosmogramme/tests/php/classes/CdScriptIntegrationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..41d866c002ca14c64775d9f0275de4eb4349d530 --- /dev/null +++ b/cosmogramme/tests/php/classes/CdScriptIntegrationTest.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 + */ + +require_once('NoticeIntegrationTest.php'); + +abstract class CdScriptIntegrationTestCase extends NoticeIntegrationTestCase { + public function getProfilDonnees() { + $profil = Class_IntProfilDonnees::forCdScript()->setIdProfil(115); + return $profil->getRawAttributes(); + } +} + + + +class CdScriptIntegrationLeKiosqueTest extends CdScriptIntegrationTestCase { + public function setUp() { + parent::setUp(); + + $this->fixture('Class_CosmoVar', + ['id' => 'types_docs', + 'liste' => '0:Livre et cartes\r\n1:Livres\r\n2:Revues\r\n3:Disques\r\n4:DVD\r\n5:Cédéroms\r\n6:Partitions\r\n7:Livres lus\r\n8:articles\r\n9:fils rss\r\n10:Le Kiosque\r\n11:ToutApprendre\r\n12:ArteVOD\r\n']); + + $this->loadRecordsFromFile('unimarc_le_kiosque'); + $this->_deco_magazine = Class_Notice::find(1); + } + + + /** @test */ + public function decoMagazineTypeDowShouldBeLeKiosque() { + $this->assertContains('T10', $this->_deco_magazine->getFacettes()); + } + + + /** @test */ + public function resumeShouldContainsDecoMagazineAndRevue() { + $this->assertEquals("Revue trimestrielle qui allie l'architecture à la décoration et se veut une publication de référence, d'information et d'orientation.", $this->_deco_magazine->getResume()); + } +} \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index 0436e3e78fa5ecf417e1a428027f0d8c1596fdb8..39e0c9f7fc143ab0db7067e83f7ccf247e9a4dca 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -140,7 +140,6 @@ abstract class NoticeIntegrationTestCase extends ModelTestCase { ->whenCalled('run') ->answers(['statut' => 'KO']); $this->notice_integration->setServiceRunner($this->_service_runner); - $this->notice_integration->traiteNotice($unimarc); $this->notice_integration->traiteFacettes(); $this->notice_data = $this->notice_integration->getNotice(); diff --git a/cosmogramme/tests/php/classes/unimarc_le_kiosque.txt b/cosmogramme/tests/php/classes/unimarc_le_kiosque.txt new file mode 100644 index 0000000000000000000000000000000000000000..853bf8b7c46c44353a0ecc832c5cee2a009d30d2 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_le_kiosque.txt @@ -0,0 +1 @@ +00680nas1 2200169 i 450 0010008000001000041000081010008000492000052000572100032001092150008001413300058001493300142002076100025003498010015003748560092003899950029004811901090 a20150923d |0fre|01 ||||ba afre aDéco MagazinebMagazine numériqued23/09/2015 cLes Editions Orientales Sal a324 aDernier numéro paru : Déco Magazine, 62, 23/09/2015 aRevue trimestrielle qui allie l'architecture à la décoration et se veut une publication de référence, d'information et d'orientation. aPresse spécialisée bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/1901090/1916525/Images/Detail.jpg aLe Kiosquebkiof190109000683nas1 2200169 i 450 0010008000001000041000081010008000492000052000572100032001092150008001413300059001493300144002086100025003528010015003778560092003929950029004841901085 a20150807d |0fre|01 ||||ba afre aFemme MagazinebMagazine numériqued07/08/2015 cLes Editions Orientales Sal a180 aDernier numéro paru : Femme Magazine, 266, 07/08/2015 aMensuel féminin francophone. Beauté, mode, santé, éducation, activités culturelles et artistiques, décoration, évasion, mondanités. aPresse spécialisée bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/1901085/1913840/Images/Detail.jpg aLe Kiosquebkiof190108500652nas1 2200169 i 450 0010008000001000041000081010008000492000054000572100032001112150007001433300062001503300109002126100025003218010015003468560092003619950029004531901083 a20150918d |0fre|01 ||||ba afre aL'Hebdo MagazinebMagazine numériqued18/09/2015 cLes Editions Orientales Sal a64 aDernier numéro paru : L'Hebdo Magazine, 3019, 18/09/2015 aHebdomadaire Francophone au Liban. Actualité Politique, Economie, Reportage, Confidences, Interview ... aPresse spécialisée bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/1901083/1916207/Images/Detail.jpg aLe Kiosquebkiof190108300655nas1 2200169 i 450 001000700000100004100007101000800048200005800056210001400114215000700128330006500135330014100200610001000341801001500351856009100366995002800457851749 a20150910d |0fre|01 ||||ba afre aLe 10 Sport NationalbMagazine numériqued10/09/2015 c10 Medias a32 aDernier numéro paru : Le 10 Sport National, 403, 10/09/2015 aLe 10 Sport National est le mensuel entièrement dédié au sport. Vous y trouverez les infos foot, tennis ou encore basket du moment... aSport bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/851749/1915758/Images/Detail.jpg aLe Kiosquebkiof85174900801nas1 2200169 i 450 001000700000100004100007101000800048200005100056210001200107215000800119330005700127330030000184610001300484801001500497856009100512995002800603623107 a20150915d |0fre|01 ||||ba afre aMen''s HealthbMagazine numériqued15/09/2015 c1633 SA a124 aDernier numéro paru : Men''s Health, 79, 15/09/2015 aLE SEUL MAGAZINE MASCULIN QUI AMÉLIORE LE QUOTIDIEN DES HOMMES. Forme, nutrition, sports, santé, bons plans, infos, sexo. Retrouvez chaque mois dans Men's Health, mille conseils et astuces pratiques de nos spécialistes et experts pour être au top, bien dans sa tête et bien dans son corps. aMasculin bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/623107/1915889/Images/Detail.jpg aLe Kiosquebkiof62310700801nas1 2200169 i 450 001000700000100004100007101000800048200005700056210001200113215000800125330006300133330028800196610001300484801001500497856009100512995002800603785977 a20150630d |0fre|01 ||||ba afre aMen''s Health CoachbMagazine numériqued30/06/2015 c1633 SA a132 aDernier numéro paru : Men''s Health Coach, 18, 30/06/2015 aAvec 130 pages de conseils, les Hors Séries Coach de Men's Health s'imposent en véritable guide et partenaire au quotidien. Leur objectif : «Coacher» les lecteurs qui souhaitent associer hygiène de vie nutritionnelle et bien-être mental, ou encore suivre une (re)mise en forme. aMasculin bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/785977/1911449/Images/Detail.jpg aLe Kiosquebkiof78597700550nas1 2200169 i 450 001000400000100004100004101000800045200005700053210001200110215000800122330006400130330004500194610001300239801001500252856008800267995002500355319 a20150731d |0fre|01 ||||ba afre aQuestions de FemmesbMagazine numériqued31/07/2015 c1633 SA a136 aDernier numéro paru : Questions de Femmes, 208, 31/07/2015 aLe magazine de l''actualité au féminin aFéminin bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/319/1912986/Images/Detail.jpg aLe Kiosquebkiof31900845nas1 2200169 i 450 0010008000001000041000081010008000492000069000572100012001262150008001383300074001463300306002206100013005268010015005398560092005549950029006461911278 a20150711d |0fre|01 ||||ba afre aQuestions de Femmes Hors SériebMagazine numériqued11/07/2015 c1633 SA a100 aDernier numéro paru : Questions de Femmes Hors Série, 1, 11/07/2015 aLe Hors-Série 100% Astro de l''été par Questions de Femmes. 100 pages 100% astro, mandala et jeux pour savoir ce que vous réservent les astres, retrouver l''harmonie et vous détendre... Comment le séduire selon son signe ? Comment se faire passer la bague au doigt ? Une analyse signe par signe. aFéminin bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/1911278/1911590/Images/Detail.jpg aLe Kiosquebkiof191127801111nas1 2200169 i 450 0010008000001000041000081010008000492000070000572100012001272150008001393300075001473300570002226100013007928010015008058560092008209950029009121911870 a20150630d |0fre|01 ||||ba afre aRéponses de Questions de FemmesbMagazine numériqued30/06/2015 c1633 SA a132 aDernier numéro paru : Réponses de Questions de Femmes, 2, 30/06/2015 aUn guide pratique thématique pour toutes les femmes Réponses de Questions de femmes s'adresse à toutes les femmes, quels que soient leur âge, leur condition physique, leur mode de vie, leurs envies. Au menu : des réponses d'experts sur des sujets qui vous titillent (beauté, mode, finance, vie quotidienne, santé....), des problématiques qui vous préoccupent, ou de simples petites interrogations qui vous taraudent. Réponses de Questions de femmes a pour ambition de vous livrer « vos » propres clés afin de retrouver un lien positif avec votre corps. aFéminin bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/1911870/1911872/Images/Detail.jpg aLe Kiosquebkiof191187001029nas1 2200169 i 450 00100060000010000410000610100080004720000510005521000120010621500080011833000570012633005320018361000120071580100150072785600900074299500270083226192 a20150917d |0fre|01 ||||ba afre aRolling StonebMagazine numériqued17/09/2015 c1633 SA a100 aDernier numéro paru : Rolling Stone, 78, 17/09/2015 aROLLING STONE, le seul VRAI magazine de la Culture Rock ! Culte, original et créatif, Rolling Stone anticipe les modes, digère les tendances et les met en perspective. Il trouve ainsi sa place parmi les magazines musicaux et multiculturels en envisageant la musique comme moteur de société. L''édition française s''attache, entre légende et modernité, à décrypter les tendances marquantes d''une galaxie rock toujours en expansion. Profitez de notre offre d'abonnement exceptionnelle : 6 numéros pour le prix de 5 ! aCulture bLe Kiosque 2Vignetteuhttp://cdn2.lekiosk.com/Public/Publications/26192/1915888/Images/Detail.jpg aLe Kiosquebkiof26192 \ No newline at end of file diff --git a/library/Class/Exemplaire.php b/library/Class/Exemplaire.php index f21c0f981cc5a0fd6cbe99334a5bafa52359f9ee..4e861710b87f2ca8bcccbab6fa83ad5d26746fa6 100644 --- a/library/Class/Exemplaire.php +++ b/library/Class/Exemplaire.php @@ -70,6 +70,7 @@ class Class_Exemplaire extends Storm_Model_Abstract { return $site->getLibelle(); } + public function getBibLibelle() { return $this->hasBib() ? $this->getBib()->getLibelle() : ''; diff --git a/library/Class/IntBib.php b/library/Class/IntBib.php index ae95a9f4177bcbcdbfe9290645339c90f99f75ab..5ab61c81eebd4ac7754f731f283319c79c62a3c5 100644 --- a/library/Class/IntBib.php +++ b/library/Class/IntBib.php @@ -38,6 +38,7 @@ class Class_IntBib extends Storm_Model_Abstract { const COM_MICROBIB = 9; const COM_BIBLIXNET = 10; const COM_DYNIX = 11; + const COM_CDSCRIPT = 12; protected static $COM_CLASSES = [self::COM_PERGAME => 'Class_WebService_SIGB_Pergame', self::COM_OPSYS => 'Class_WebService_SIGB_Opsys', @@ -48,7 +49,8 @@ class Class_IntBib extends Storm_Model_Abstract { self::COM_ORPHEE => 'Class_WebService_SIGB_Orphee', self::COM_MICROBIB => 'Class_WebService_SIGB_Microbib', self::COM_BIBLIXNET => 'Class_WebService_SIGB_BiblixNet', - self::COM_DYNIX => 'Class_WebService_SIGB_Dynix']; + self::COM_DYNIX => 'Class_WebService_SIGB_Dynix', + self::COM_CDSCRIPT => 'Class_WebService_SIGB_CdScript']; protected $_table_name = 'int_bib'; protected $_table_primary = 'id_bib'; diff --git a/library/Class/IntProfilDonnees.php b/library/Class/IntProfilDonnees.php index 9cccbd19b4a66ecf351ad10f7fc572aa7ec674ba..b7393013d5a023d0f87ac0444493d9c37fa0c129 100644 --- a/library/Class/IntProfilDonnees.php +++ b/library/Class/IntProfilDonnees.php @@ -420,6 +420,46 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { } + public static function forCdScript() { + return self:: + newInstance(['libelle' => 'Unimarc Cd-Script', + 'accents' => self::ENCODING_UTF8, + 'rejet_periodiques' => '0', + 'id_article_periodique' => self::SERIAL_FORMAT_NONE, + 'type_fichier' => self::FT_RECORDS, + 'format' => self::FORMAT_UNIMARC, + 'attributs' => + [['type_doc' => + [[ 'code' => '0', 'label' => '', 'zone_995' => '' ], + [ 'code' => '1', 'label' => 'am;na', 'zone_995' => '' ], + [ 'code' => '2', 'label' => 'as', 'zone_995' => ''], + [ 'code' => '3', 'label' => 'i;j', 'zone_995' => ''], + [ 'code' => '4', 'label' => 'g','zone_995' => ''], + [ 'code' => '5', 'label' => 'l;m', 'zone_995' => ''], + [ 'code' => '6', 'label' => '', 'zone_995' => '' ], + [ 'code' => '7', 'label' => '', 'zone_995' => '' ], + [ 'code' => '8', 'label' => '', 'zone_995' => ''], + [ 'code' => '9', 'label' => '', 'zone_995' => ''], + [ 'code' => '10', 'label' => '', 'zone_995' => 'kio'], + [ 'code' => '11', 'label' => '', 'zone_995' => 'tou'], + [ 'code' => '12', 'label' => '', 'zone_995' => 'art'], + ], + self::FIELD_ITEM_BARCODE => 'f', + self::FIELD_ITEM_COTE => 'k', + self::FIELD_ITEM_TYPE_DOC => 'b', + self::FIELD_ITEM_GENRE => '', + self::FIELD_ITEM_SECTION => 'j', + self::FIELD_ITEM_EMPLACEMENT => 'u', + self::FIELD_ITEM_ANNEXE => '' + ], + ['zone' => '995', + 'champ' => '4', + 'format' => self::NOVELTY_DATE_FORMAT_AAAA_MM_JJ, + 'jours' => '', + 'valeurs' => '']]]); + } + + public function setAttributs($array_or_string) { return $this->_set('attributs', is_array($array_or_string) diff --git a/library/Class/Notice.php b/library/Class/Notice.php index 6b2449a6635e1fb3de52ca61bb5243bc6f3d2601..c82a399d48724e437d6a3fac61d742fec5f6a845 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -1470,8 +1470,9 @@ class Class_Notice extends Storm_Model_Abstract { return $album->getDescription(); $data = $this->get_subfield('330', 'a'); - return $this->_resume = ($resume = $this->_getHtmlSummary($data)) ? - $resume : $this->_getTextSummary($data); + + return $this->_resume = (($resume = $this->_getHtmlSummary($data)) ? + $resume : $this->_getTextSummary($data)); } diff --git a/library/Class/WebService/SIGB/CdScript.php b/library/Class/WebService/SIGB/CdScript.php new file mode 100644 index 0000000000000000000000000000000000000000..371a4b8eae34f7de9f21327939031f24fb230135 --- /dev/null +++ b/library/Class/WebService/SIGB/CdScript.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright (c) 2012-2014, 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_WebService_SIGB_CdScript { + protected static $service; + + public static function getService($params){ + + if (!isset(static::$service)) { + $instance = new static(); + $classname = get_called_class().'_Service'; + static::$service = $classname::getService($params['server_url'], + $params['remote_library_id']); + } + + return static::$service; + } + +} +?> \ No newline at end of file diff --git a/library/Class/WebService/SIGB/CdScript/Service.php b/library/Class/WebService/SIGB/CdScript/Service.php new file mode 100644 index 0000000000000000000000000000000000000000..f04aaab5105f74e651ec599c90a4fa556485072f --- /dev/null +++ b/library/Class/WebService/SIGB/CdScript/Service.php @@ -0,0 +1,128 @@ +<?php +/** + * Copyright (c) 2012-2014, 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_Webservice_SIGB_CdScript_Service { + use Trait_TimeSource; + + protected + $_server_url, + $_remote_library_id; + + + public static function getService($server_url, $remote_library_id) { + return (new static()) + ->setServerUrl($server_url) + ->setRemoteLibraryId($remote_library_id); + } + + + protected function setServerUrl($url) { + $this->_server_url = $url; + return $this; + } + + + protected function setRemoteLibraryId($remote_library_id) { + $this->_remote_library_id = $remote_library_id; + return $this; + } + + + public function getBaseUrl() { + return $this->_server_url . '?'; + } + + + protected function getRemoteLibraryId() { + return ['bib' => $this->_remote_library_id]; + } + + + public function getRessourceUrl($item) { + if(!$item) + return ''; + + if(!$user = Class_Users::getIdentity()) + return ''; + + $data = array_merge($this->getRemoteLibraryId(), + ['res' => $item->getSubfield('b'), + 'lien' => $item->getIdOrigine(), + 'time' => $this->getCurrentTime()]); + + return $this->getBaseUrl() . http_build_query($data) . $this->getUserInfo($user); + } + + + protected function getUserInfo($user) { + return '&user='. implode(':', [$user->getIdSigb(), + $user->getNom(), + $user->getPrenom(), + $user->getNaissance(), + '', + $user->getDateFin()]); + } + + + public function getNotice($id) { + $sigb_record = new Class_WebService_SIGB_Notice($id); + $sigb_item = new Class_WebService_SIGB_Exemplaire($id); + + if($item = $this->_getItem($id)) { + $sigb_item->setCodeBarre($id); + $sigb_item->setBibliotheque($item->getBib()); + $item->setUrl($this->getRessourceUrl($item))->save(); + } + $sigb_record->addExemplaire($sigb_item); + return $sigb_record; + } + + + public function getNoticeCache() { + if (!isset($this->_notice_cache)) + $this->_notice_cache = new Class_WebService_SIGB_NoticeCache($this); + return $this->_notice_cache; + } + + + public function getExemplaire($notice_id, $code_barre){ + $item = $this->getNoticeCache()->getExemplaire($notice_id, $code_barre); + return $item; + } + + + protected function _getCdScriptLibId() { + if($lib = Class_IntBib::findFirstBy(['comm_sigb' => Class_IntBib::COM_CDSCRIPT])) + return $lib->getIdBib(); + return ''; + } + + + protected function _getItem($id) { + if(!$lib = $this->_getCdScriptLibId()) + return null; + + return Class_Exemplaire::findFirstBy(['code_barres' => $id, + 'id_int_bib' => $lib]); + } +} +?> \ No newline at end of file diff --git a/library/Class/WebService/SIGB/NoticeCache.php b/library/Class/WebService/SIGB/NoticeCache.php index ff1211d3f0dd696ce369414e95088a80e4c94263..b038912ef04942d294fa8ada360a9be68816124c 100644 --- a/library/Class/WebService/SIGB/NoticeCache.php +++ b/library/Class/WebService/SIGB/NoticeCache.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 */ /* diff --git a/library/ZendAfi/Auth.php b/library/ZendAfi/Auth.php index 0c59f894c698609783ea255e6b4b198dcd798572..e24b1dc0b58185ad1f6cd8788cd45884e04edf35 100644 --- a/library/ZendAfi/Auth.php +++ b/library/ZendAfi/Auth.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 */ class ZendAfi_Auth extends Zend_Auth { @@ -43,7 +43,7 @@ class ZendAfi_Auth extends Zend_Auth { return [ $this->newAuthSIGB(), $this->newAuthDb() ]; } - + public function newAuthDb() { $authAdapter = new ZendAfi_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter()); $authAdapter->setTableName('bib_admin_users'); diff --git a/library/ZendAfi/View/Helper/Notice/Exemplaires.php b/library/ZendAfi/View/Helper/Notice/Exemplaires.php index 0718501ce063dd83e27d4cc5151c9a4217ef8605..dfa52ee83bcf5525dc540fd358b9552ff380d1b9 100644 --- a/library/ZendAfi/View/Helper/Notice/Exemplaires.php +++ b/library/ZendAfi/View/Helper/Notice/Exemplaires.php @@ -151,7 +151,6 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends ZendAfi_View_Helper_BaseHel class ZendAfi_View_Helper_Notice_Exemplaires_RenderByGroup extends ZendAfi_View_Helper_Notice_Exemplaires { public function Notice_Exemplaires_RenderByGroup($exemplaires, $preferences, $nb_notices_oeuvre=0, $aff="normal") { - $group_exemplaires = []; foreach($this->exemplairesToRows($exemplaires) as $ex) { $group_key = $ex['id_notice'].'_'.$ex['id_bib'].'_'.$ex['cote']; @@ -171,7 +170,6 @@ class ZendAfi_View_Helper_Notice_Exemplaires_RenderByGroup extends ZendAfi_View_ class ZendAfi_View_Helper_Notice_Exemplaires_RenderByItem extends ZendAfi_View_Helper_Notice_Exemplaires { public function Notice_Exemplaires_RenderByItem($exemplaires, $preferences, $nb_notices_oeuvre=0, $aff='normal') { $exemplaires = $this->_getSortedItems($exemplaires, $preferences); - return $this->render((new Class_CommSigb())->getDispoExemplaires($exemplaires), $preferences, $nb_notices_oeuvre, diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php new file mode 100644 index 0000000000000000000000000000000000000000..65e0b95fcaec3c873d881f43de3cc11c1087e61c --- /dev/null +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php @@ -0,0 +1,102 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 NoticeAjaxControllerCdScriptRecordTest extends AbstractControllerTestCase { + protected + $_storm_default_to_volatile = true, + $_record_le_kiosque, + $_item_le_kiosque, + $_service, + $_sigb_le_kiosque, + $_paul; + + public function setUp() { + parent::setUp(); + + $this->_paul = $this->fixture('Class_Users', + ['id' => 15, + 'login' => 'paul', + 'nom' => 'Le Pollux', + 'prenom' => 'Paul', + 'id_sigb' => '654987', + 'mail' => 'anemail@web.com', + 'naissance' => '2002-12-14', + 'password' => 'pollux', + 'date_fin' => '2015-12-14']); + + ZendAfi_Auth::getInstance()->logUser($this->_paul); + + $config = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray(); + $config['exemplaires']['grouper'] = '1'; + Class_Profil::getCurrentProfil()->setCfgNotice($config); + + $this->fixture('Class_IntBib', + ['id' => 31, + 'libelle' => 'le kiosque library', + 'comm_sigb' => Class_IntBib::COM_CDSCRIPT]); + + $this->fixture('Class_Bib', + ['id' => 3, + 'libelle' => 'Le kiosque library']); + + $this->_item_le_kiosque = $this->fixture('Class_Exemplaire', + ['id' => 1, + 'code_barres' => '456789', + 'id_origine' => '456789', + 'id_notice' => 2, + 'id_int_bib' => 31, + 'id_bib' => 3, + 'cote' => '', + 'zone995' => 'a:3:{i:0;a:2:{s:4:"code";s:1:"a";s:6:"valeur";s:10:"Le Kiosque";}i:1;a:2:{s:4:"code";s:1:"b";s:6:"valeur";s:3:"kio";}i:2;a:2:{s:4:"code";s:1:"f";s:6:"valeur";s:3:"319";}}']); + + $this->_record_le_kiosque = $this->fixture('Class_Notice', + ['id' => 2, + 'exemplaires' => [$this->_item_le_kiosque]]); + + $this->_service = Class_WebService_SIGB_CdScript::getService(['server_url' => 'www.jumel39.fr/docnum.php', + 'remote_library_id' => 2]); + $this->_service->setTimeSource(new TimeSourceForTest('2015-10-28 09:00:00')); + + $this->_sigb_le_kiosque = $this->_service->getNotice('456789')->getExemplaireByCodeBarre('456789'); + + $this->dispatch('/opac/noticeajax/exemplaires/id_notice/2', true); + } + + + /** @test */ + public function linkToJumelShouldBePresent() { + $this->assertXPathContentContains('//table//a[contains(@href, "www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14::2015-12-14")]', 'Description en ligne', $this->_response->getBody()); + } + + + /** @test */ + public function libraryLabelShouldBeLeKiosqueLibrary() { + $this->assertXPathContentContains('//table//td', 'Le kiosque library'); + } + + + /** @test */ + public function scriptTargetBlankShouldBePresent() { + $this->assertXPathContentContains('//script', 'setupAnchorsTarget'); + } +} +?> \ No newline at end of file diff --git a/tests/db/UpgradeDBTest.php b/tests/db/UpgradeDBTest.php index adb49124462df6ffc8ec3659d9818ba7774d5c9a..b56a38ca5fdb8f2922102deef61888766c5f18a8 100644 --- a/tests/db/UpgradeDBTest.php +++ b/tests/db/UpgradeDBTest.php @@ -173,4 +173,27 @@ class UpgradeDB_277_Test extends UpgradeDBTestCase { $query = 'select * from exemplaires where id_notice in (' . implode(', ', static::$_inserted_records) .')'; $this->assertEmpty($this->query($query)->fetchAll()); } -} \ No newline at end of file +} + + + +class UpgradeDB_278_Test extends UpgradeDBTestCase { + + public function prepare() { + $this->query("update variables set liste='0:Pas informatisé\r\n1:Pergame\r\n2:Paprika\r\n3:Orphée\r\n4:Opsys\r\n5:Microbib\r\n6:Atalante\r\n7:Multilis\r\n8:Bibal\r\n9:Milord\r\n10:Elissa\r\n11:v-smart\r\n12:Koha\r\n13:Nanook\r\n14:Carthame\r\n15:Dynix\r\n' where clef='sigb';"); + + $this->query("update variables set liste='0:aucun\r\n1:pergame\r\n2:web-service Opsys\r\n3:serveur Z39.50\r\n4:web-service V-Smart\r\n5:web-service Koha\r\n6:web-service Carthame\r\n7:web-service AFI-Nanook\r\n8:web-service Orphée\r\n9:web-service Microbib\r\n10:web-service BiblixNet\r\n11:web-service Dynix-Symphony\r\n' where clef='comm_sigb';"); + } + + + /** @test */ + public function cdScriptShouldBePresentInSigbList() { + $this->assertContains("16:Cd-Script\r\n", $this->query('select liste from variables where clef = "sigb";')->fetch()['liste']); + } + + + /** @test */ + public function cdScriptShouldBePresentInCommSigbList() { + $this->assertContains("12:Cd-Script\r\n", $this->query('select liste from variables where clef = "comm_sigb";')->fetch()['liste']); + } +} diff --git a/tests/library/Class/CommSigbTest.php b/tests/library/Class/CommSigbTest.php index 7a02654ea532276ccb7e83db67252f0b652ca2f9..b6c2eb74746e33f694d300af5e78c597acbe0a21 100644 --- a/tests/library/Class/CommSigbTest.php +++ b/tests/library/Class/CommSigbTest.php @@ -536,8 +536,6 @@ class CommSigbMicrobibTest extends CommSigbTestCase { - - class CommSigbBiblixNetTest extends CommSigbTestCase { public function setUp() { parent::setUp(); @@ -562,7 +560,6 @@ class CommSigbBiblixNetTest extends CommSigbTestCase { - class CommSigbDynixTest extends CommSigbTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/WebService/SIGB/CdScriptTest.php b/tests/library/Class/WebService/SIGB/CdScriptTest.php new file mode 100644 index 0000000000000000000000000000000000000000..23fd616754423d3de4528a6d34d6aaad44fea265 --- /dev/null +++ b/tests/library/Class/WebService/SIGB/CdScriptTest.php @@ -0,0 +1,113 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 + */ + + +abstract class CdScriptTestCase extends Storm_Test_ModelTestCase { + protected $_service; + + public function setUp() { + parent::setUp(); + $this->_service = Class_WebService_SIGB_CdScript::getService(['server_url' => 'www.jumel39.fr/docnum.php', + 'remote_library_id' => 2]); + $this->_service->setTimeSource(new TimeSourceForTest('2015-10-28 09:00:00')); + } +} + + + +class CdScriptServiceTest extends CdScriptTestCase { + protected + $_paul, + $_le_kiosque, + $_sigb_le_kiosque; + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_IntBib', + ['id' => 31, + 'libelle' => 'le kiosque library', + 'comm_sigb' => Class_IntBib::COM_CDSCRIPT]); + + $this->fixture('Class_Bib', + ['id' => 3, + 'libelle' => 'Le kiosque library']); + + $this->_paul = $this->fixture('Class_Users', + ['id' => 15, + 'login' => 'paul', + 'nom' => 'Le Pollux', + 'prenom' => 'Paul', + 'id_sigb' => '654987', + 'mail' => 'anemail@web.com', + 'naissance' => '2002-12-14', + 'password' => 'pollux', + 'date_fin' => '2015-12-14']); + + ZendAfi_Auth::getInstance()->logUser($this->_paul); + + $this->_le_kiosque = $this->fixture('Class_Exemplaire', + ['id' => 1, + 'code_barres' => '456789', + 'id_origine' => '456789', + 'id_int_bib' => 31, + 'id_bib' => 3, + 'zone995' => 'a:3:{i:0;a:2:{s:4:"code";s:1:"a";s:6:"valeur";s:10:"Le Kiosque";}i:1;a:2:{s:4:"code";s:1:"b";s:6:"valeur";s:3:"kio";}i:2;a:2:{s:4:"code";s:1:"f";s:6:"valeur";s:3:"319";}}']); + + $this->_sigb_le_kiosque = $this->_service->getNotice('456789')->getExemplaireByCodeBarre('456789'); + } + + + /** @test */ + public function paulShouldBeLogged() { + $this->assertSame($this->_paul, Class_Users::getIdentity()); + } + + + /** @test */ + public function baseUrlShouldReturnJumel() { + $this->assertEquals('www.jumel39.fr/docnum.php?', $this->_service->getBaseUrl()); + } + + + /** @test */ + public function ressourceUrlShouldBeJumelBib2UserPaulAnd12oclok() { + $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14::2015-12-14', $this->_service->getRessourceUrl($this->_le_kiosque)); + } + + + /** @test */ + public function leKiosqueItemIdShouldBe456789() { + $this->assertEquals('456789', $this->_sigb_le_kiosque->getId()); + } + + + /** @test */ + public function leKiosqueItemUrlShouldBeJumelLink() { + $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14::2015-12-14', $this->_le_kiosque->getUrl()); + } + + + /** @test */ + public function leKiosqueBibShouldBeLeKiosqueLibrary() { + $this->assertEquals('Le kiosque library', $this->_sigb_le_kiosque->getBibliotheque()->getLibelle()); + } +} diff --git a/tests/library/Class/WebService/SIGB/NanookTest.php b/tests/library/Class/WebService/SIGB/NanookTest.php index 13fd816d0267487d733f995ab2d4d295a96949c0..f3558fa07200b7434ff4b7ec0895c1503c31eb88 100644 --- a/tests/library/Class/WebService/SIGB/NanookTest.php +++ b/tests/library/Class/WebService/SIGB/NanookTest.php @@ -61,7 +61,6 @@ class NanookGetServiceTest extends Storm_Test_ModelTestCase { - abstract class NanookTestCase extends Storm_Test_ModelTestCase { /** @var PHPUnit_Framework_MockObject_MockObject */ protected $_mock_web_client;