diff --git a/VERSIONS_HOTLINE/17196 b/VERSIONS_HOTLINE/17196 new file mode 100644 index 0000000000000000000000000000000000000000..a0296e983dabe6b65c084d98afd14a105c974ef5 --- /dev/null +++ b/VERSIONS_HOTLINE/17196 @@ -0,0 +1 @@ +- ticket #17196 : Cosmogramme : correction de la détection de certains type de documents configuré avec un 995$r commençant par "p" \ No newline at end of file diff --git a/VERSIONS_HOTLINE/17262 b/VERSIONS_HOTLINE/17262 new file mode 100644 index 0000000000000000000000000000000000000000..78077f026faa8de9f05be40a3edc9c23a3c9d734 --- /dev/null +++ b/VERSIONS_HOTLINE/17262 @@ -0,0 +1 @@ +- ticket #17262: Rend possible l'utilisation de la même valeur pour les variables FACETTE_*_LIBELLE \ No newline at end of file diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index b2efdc511592baff47ef383a0f7ac2b8a3c2ffd6..7ce7085c40483d7d747256611567c2a95c54dbbb 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -145,7 +145,7 @@ class NoticeAjaxController extends Zend_Controller_Action { protected function _loadExemplaireWhere($where) { // Lire les notices groupees ou pas if (0 == $this->notice_html->preferences["exemplaires"]["grouper"]) - return fetchAll("Select id_notice,id_bib,cote,count(*) from exemplaires " . $where . " group by 1,2,3" ); + return fetchAll("Select id_notice,id_bib,cote,count(*),id_int_bib,id_origine from exemplaires " . $where . " group by 1,2,3" ); return fetchAll("Select * from exemplaires " . $where); } diff --git a/cosmogramme/php/classes/classe_profil_donnees.php b/cosmogramme/php/classes/classe_profil_donnees.php index d5d0c4a4fe829de0be5ce67e201443109d99315a..fd236a21db7c489af16e9a8ecab2434fb2a866ab 100644 --- a/cosmogramme/php/classes/classe_profil_donnees.php +++ b/cosmogramme/php/classes/classe_profil_donnees.php @@ -1,4 +1,4 @@ -<?PHP +<?php /** * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. * @@ -18,12 +18,8 @@ * along with AFI-OPAC 2.0; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -////////////////////////////////////////////////////////////////////////////////////// -// PROFILS DE DONNEES POUR LES IMPORTS -////////////////////////////////////////////////////////////////////////////////////// -class profil_donnees -{ +class profil_donnees { private $id_profil; // Id sgbd private $libelle; // Libellé du profil private $rejet_periodiques; // Rejet des periodiques dans les imports @@ -34,18 +30,12 @@ class profil_donnees private $attributs; // Bloc de donnees associe au format private $varTypeDoc; // Liste des types de docs définie dans les variables -//--------------------------------------------------------------------------------- -// Constructeur lit la variable types_doc et la decompose -//--------------------------------------------------------------------------------- - function __construct() - { - $this->varTypeDoc=getCodifsVariable("types_docs"); + function __construct() { + $this->varTypeDoc = getCodifsVariable("types_docs"); } -//--------------------------------------------------------------------------------- -// Lit un profil et le decompresse -//--------------------------------------------------------------------------------- - public function lire($id_profil) { + + public function lire($id_profil) { // Profils d'homogeneisation : -1= isbn -2=ean if ($id_profil < 0) { $this->getProfilStandard($id_profil); @@ -118,11 +108,8 @@ class profil_donnees return $this->id_profil; } -//--------------------------------------------------------------------------------- -// Renvoie toute la structure du profil -//--------------------------------------------------------------------------------- - public function getProfil($id_profil) - { + + public function getProfil($id_profil) { $this->lire($id_profil); $profil["id_profil"]=$this->id_profil; $profil["libelle"]=$this->libelle; @@ -135,33 +122,29 @@ class profil_donnees if(!$profil["attributs"][0]["champ_cote"]) $profil["attributs"][0]["champ_cote"]="k"; return $profil; } -//--------------------------------------------------------------------------------- -// Profils standard réhomogénéisations : -1: panier d'isbn -2:panier d'ean -//--------------------------------------------------------------------------------- - private function getProfilStandard($id_profil) - { + + + /** + * Profils standard réhomogénéisations : -1: panier d'isbn -2:panier d'ean + */ + private function getProfilStandard($id_profil) { $this->id_profil=$id_profil; $this->accents=1; $this->rejet_periodiques=0; $this->id_article_periodique=0; $this->type_fichier=0; $this->format=1; - if($id_profil == -1) - { + if($id_profil == -1) { $this->libelle="Homogénéisation d'isbn"; $this->attributs[1]["champs"]="isbn"; - } - else - { + } else { $this->libelle="Homogénéisation d'ean"; $this->attributs[1]["champs"]="ean"; } } -//--------------------------------------------------------------------------------- -// Rend un combo avec la liste des profils -//--------------------------------------------------------------------------------- - public function getCombo($valeur) - { + + + public function getCombo($valeur) { global $sql; $data=$sql->fetchAll("Select id_profil,libelle from profil_donnees"); $combo='<select name="profil">'; @@ -174,11 +157,9 @@ class profil_donnees $combo.='</select>'; return $combo; } -//--------------------------------------------------------------------------------- -// Ecrire -//--------------------------------------------------------------------------------- - public function ecrire($id_profil,$libelle,$accents,$rejet_periodiques,$type_fichier,$format,$attributs,$id_article_periodique) - { + + + public function ecrire($id_profil,$libelle,$accents,$rejet_periodiques,$type_fichier,$format,$attributs,$id_article_periodique) { //tracedebug(1,$attributs,true); if(!trim($libelle)) return false; global $sql; @@ -188,11 +169,9 @@ class profil_donnees else $sql->update("Update profil_donnees set @SET@ Where id_profil ='$id_profil'",$data); } -//--------------------------------------------------------------------------------- -// Analyse d'un label et zones 995 pour determiner un type de doc -//--------------------------------------------------------------------------------- - public function getTypeDoc($label,$z995,$z995p) { - if($this->isknowAsSerieWith([$z995, $s995p])) + + public function getTypeDoc($label, $z995r, $z995p) { + if (strToUpper(substr(trim($z995p), 0, 1)) == 'P') return ['code' => 2, 'libelle' => 'Périodiques']; if ($this->isArticlePeriodique($label)) @@ -200,7 +179,7 @@ class profil_donnees // First we check 995$r subfield. foreach($this->attributs[0]["type_doc"] as $td) { - if ($this->isTypeDocMatchOneBiblioItem($z995, $td)) + if ($this->isTypeDocMatchOneBiblioItem($z995r, $td)) return ['code' => $td['code'], 'libelle' => $td['libelle']]; } @@ -267,27 +246,13 @@ class profil_donnees return $ret; } -//--------------------------------------------------------------------------------- -// Analyse article de périodique -//--------------------------------------------------------------------------------- - public function isArticlePeriodique($label) - { - switch($this->id_article_periodique) - { + + public function isArticlePeriodique($label) { + switch($this->id_article_periodique) { case 1: if($label=="aa") return true; // pergame case 2: if($label=="aa") return true; // opsys indexpresse default: return false; } } - - - - protected function isKnowAsSerieWith($codes = []) { - foreach($codes as $code) { - if(strToUpper(substr(trim($code[0]),0,1)) == "P") - return true; - } - return false; - } } ?> \ No newline at end of file diff --git a/cosmogramme/php/fonctions/objets_saisie.php b/cosmogramme/php/fonctions/objets_saisie.php index 6bbe3ffd33573d666891e0c5dd90fcd107aeee48..818585f6c7b4573561223e01718da45292c2830a 100644 --- a/cosmogramme/php/fonctions/objets_saisie.php +++ b/cosmogramme/php/fonctions/objets_saisie.php @@ -90,7 +90,7 @@ function getBlocsParams($id_bib, $type, $valeurs) { $champs_params[0] = ['url_serveur']; if (in_array($clef, [COM_CARTHAME])) - $champs_params[0] = ['url_serveur', 'key']; + $champs_params[0] = ['url_serveur', 'key','sigb_field_name']; if (in_array($clef, [COM_ORPHEE])) $champs_params[0] = ['url_serveur', 'key', 'allow_hold_available_items']; diff --git a/cosmogramme/php/fonctions/variables.php b/cosmogramme/php/fonctions/variables.php index c4016788e7caefc834da258f9f1c46207fb3a26b..75e1124153b405772a9f5dfeb2278abe2ea64ced 100644 --- a/cosmogramme/php/fonctions/variables.php +++ b/cosmogramme/php/fonctions/variables.php @@ -16,17 +16,13 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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 */ -/////////////////////////////////////////////////////////////////////////////////////// -// VARIABLES -/////////////////////////////////////////////////////////////////////////////////////// - class VariableCache { static protected $_instance; protected $_valeurs, $_listes; - + public static function getInstance() { if (!isset(self::$_instance)) @@ -40,12 +36,21 @@ class VariableCache { return $this; } + public function setListeCache($listes) { $this->_listes = $listes; return $this; } - + + public function setListeCacheItem($key, $value) { + if (!is_array($this->_listes)) + $this->_listes = []; + $this->_listes[$key] = $value; + return $this; + } + + public function getValeur($clef) { global $sql; if (!isset($this->_valeurs[$clef])) @@ -95,10 +100,10 @@ function getLibCodifVariable($clef,$code) { $v=explode(chr(13).chr(10),$data); for($i=0; $i<count($v); $i++) - { - $elem=explode(":",$v[$i]); - if($code==$elem[0]) return $elem[1]; - } + { + $elem=explode(":",$v[$i]); + if($code==$elem[0]) return $elem[1]; + } } @@ -107,20 +112,20 @@ function getCodifsVariable($clef,$index_par_clefs=false) { $data = VariableCache::getInstance()->getListe($clef); $v=explode(chr(13).chr(10),$data); for($i=0; $i<count($v); $i++) - { - $elem=explode(":",$v[$i]); - if(!trim($elem[1])) continue; - if($index_par_clefs==true) { - $liste[$elem[0]]=$elem[1]; + $elem=explode(":",$v[$i]); + if(!trim($elem[1])) continue; + if($index_par_clefs==true) + { + $liste[$elem[0]]=$elem[1]; + } + else + { + $item["code"]=$elem[0]; + $item["libelle"]=$elem[1]; + $liste[]=$item; + } } - else - { - $item["code"]=$elem[0]; - $item["libelle"]=$elem[1]; - $liste[]=$item; - } - } return $liste; } diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index bb137d4f2ba89a34ddd03688f37f94b084fce8e6..d82c0aa75dd5b90698ba38c7a3b03f2101003ecc 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -479,7 +479,7 @@ class NoticeIntegrationBourdieuWithElectreGeneratedNoticeRecordTest extends Noti Storm_Test_ObjectWrapper::onLoaderOfModel('Class_CodifThesaurus') ->whenCalled('findByIdOrigineAndCode') - ->with('T380500', 'thÁemeelectre') + ->with('T380500', 'thèmeelectre') ->answers($this->fixture('Class_CodifThesaurus', ['id' => '2222', 'id_thesaurus'=>'AAAA0001222', @@ -726,9 +726,8 @@ class NoticeIntegrationCekovTest extends NoticeIntegrationTestCase { /** @test */ - public function firstItemActivityShouldBeAConsulterSurPlace() { - // 995$o=c - $this->assertEquals('à consulter sur place', + public function firstItemActivityShouldBeEnRayon() { + $this->assertEquals('En rayon', $this->notice_data['exemplaires'][0]['activite']); } } @@ -1640,20 +1639,20 @@ class NoticeIntegrationSymphonieTest extends NoticeIntegrationTestCase { class NoticeIntegrationUnimarcKohaFacetteTest extends NoticeIntegrationTestCase { - public function setUp() { - parent::setUp(); - Class_Notice::beVolatile(); - $this->loadNotice('unimarc_koha_okapi'); - } - - public function getProfilDonnees() { return Class_IntProfilDonnees::forKoha() ->setIdProfil(111) + ->setTypeDocRecognition(2, 'as', 'PRESSE') ->getRawAttributes(); } + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_koha_okapi'); + } + + /** @test */ public function clefAlphaShouldBeAsExpected() { $this->assertEquals('OKAPI---955-BAYARD--2', Class_Notice::find(1)->getClefAlpha()); diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTypeDocTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTypeDocTest.php new file mode 100644 index 0000000000000000000000000000000000000000..881caae1e1a362845c1c4ba951429b526fd0390c --- /dev/null +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTypeDocTest.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +require_once 'NoticeIntegrationTest.php'; + +/** @see http://forge.afi-sa.fr/issues/17196 */ +class NoticeIntegrationTypeDocPartitionValenceTest extends NoticeIntegrationTestCase { + public function getProfilDonnees() { + return Class_IntProfilDonnees::forKoha()->setIdProfil(113) + ->getRawAttributes(); + } + + + public function setUp() { + parent::setUp(); + VariableCache::getInstance() + ->setListeCacheItem('types_docs', "0:non identifié\r\n1:Livres\r\n2:Revues\r\n3:Disques\r\n4:DVD\r\n5:Cédéroms\r\n6:Livres CD\r\n7:Partitions\r\n8:Articles\r\n9:Fils rss\r\n10:Sites internet\r\n11:Jeux video\r\n12:Matériel\r\n13:Documents iconographiques\r\n14:Textes lus\r\n15:Cartes et plans\r\n16:Disques vinyles\r\n17:Estampes\r\n18:Liseuses\r\n100:Documents numérisés\r\n101:Diaporamas\r\n102:E-Books\r\n103:OAI\r\n104:Arte VOD\r\n105:Cours en ligne Vodeclic\r\n106:Livres numériques\r\n107:Vidéos à la demande\r\n108:Cours en ligne Tout Apprendre\r\n109:Enregistrement audio\r\n110:Numérique Premium\r\n111:Cyberlibris"); + $this->loadNotice('unimarc_musiques_europes'); + } + + + /** @test */ + public function recordDocTypeShouldBe7() { + $this->assertEquals(7, Class_Notice::find(1)->getTypeDoc()); + } +} diff --git a/cosmogramme/tests/php/classes/unimarc_musiques_europes.txt b/cosmogramme/tests/php/classes/unimarc_musiques_europes.txt new file mode 100644 index 0000000000000000000000000000000000000000..53baf75bf7e22a4ee22dd478486af0971334b49c --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_musiques_europes.txt @@ -0,0 +1 @@ +04141cam0a22014652 450000100070000000500170000703500150002407300180003901000150005709000110007210000410008320000810012421000310020521500480023630000410028446400190032546400200034446400140036446400150037846400130039346400120040646400200041846400150043846400110045346400140046446400140047846400110049246400310050346400160053446400170055046400130056746400190058046400120059946400220061146400180063346400110065146400160066246400140067846400170069246400170070946400210072646400120074746400450075946400190080446400200082346400190084346400280086246400270089046400220091746400180093946400130095746400180097046400240098846400260101246400280103846400280106646400140109446400210110846400180112946400270114746400160117446400170119046400230120746400140123046400210124446400220126546400150128746400190130246400230132146400290134446400200137346400280139346400140142146400150143546400160145046400190146646400160148546400170150146400160151846400220153446400200155646400120157646400220158846400160161046400130162646400250163946400220166446400180168646400110170446400360171546400400175146400280179146400220181946400230184146400140186446400120187846400240189046400100191446400250192446400220194946400190197146400200199046400280201046400230203846400160206146400140207746400230209146400240211446400170213846400230215546400240217846400150220246400270221746400190224454000480226360600780231168600160238969000110240570000390241680100220245580100220247780100220249995100160252199501380253732158820140415030942.0 ablv-I28707 a9788850710959 a885071095X a321588 a20071024d2006 u0frey5003 ba1 a100 mélodies célèbres d'Europe de l'EstbMusique impriméefMarc Toubiana 32612aMilancCarischd2006 a1 partition 119 pccouv ill. en could31 cm aLigne mélodique, accords chiffrés. 1tDjelem, djelem 1tChaje shukarije 1tCi lav tu 1tLoli pabay 1tEderlezi 1tRumelaj 1tDzaf me dromeha 1tNane tsora 1tCikala 1tOdel avel 1tKiz neman 1tHaralo 1tArméniens rassemblez-vous 1tYes Siretsi 1tSepastia bar 1tChalakho 1tYerkenk barenk 1tTaltala 1tCzak egy kis lany 1tMinek a szoke 1tEnekem 1tHull as ezo 1tA csitari 1tHegyek alatt 1tSzep a rozam 1tLes deux oiseaux 1tCzardas 1tLégényes: B. Eregesi mihaly legényese 1tLes yeux noirs 1tSoirs de Moscou 1tLe châle bleu 1tLes Fenêtres de Moscou 1tL'accordéon solitaire 1tPlaine, ma plaine 1tTaborna split 1tHatikvah 1tHavah naguila 1tThe partisan's song 1tUnter the white stars 1tYerushalayim shel zahav 1tHevaynu sholem alaychem 1tGas nigun 1tMechutonim tantz 1tOdessa bulgar 1tTantz, tantz yiddelach 1tMatchmakers 1tLiliano mome 1tRadka platno tache 1tPaidushko 1tVlaska racenitsa 1tRamboliskovo horo 1tBouchimich 1tPlovdisko horo 1tDevojke makedonska 1tAj iznikna mi baden drvo 1tJovano, jovanke 1tDe me molat ne se zenam 1tCupurlika 1tEleno mome 1tSadilo mome 1tKocanski cocek 1tTamo daleko 1tMajko, majko 1tNiska banja 1tNijamski rastanak 1tHocu, hocu babo 1tLandala 1tUnderground cocek 1tPasona kolo 1tCobankat 1tZenska albanska igra 1tDardha rrumbulake 1tBuzeqesh goca 1tE asia 1tValle qytetare e tiranes part.1 1tValle e te rinjve te tiranes part.1 1tI will marry a princess 1tWoman from Smyrna 1tHeroin and hashish 1tSala-sala 1tI nitsa 1tThe fisherman's son 1tSyrba 1tPolitikos hassapikos 1tSanie cu zurgulai 1tCasuta noastra 1tIonel, ionelule 1tTrandafir de la moldova 1tIn gradina lui ion 1tHai, romale 1tHora mare 1tHora ploiestenilor 1tUskudar'a gideriken 1tRampi, rampi 1tSu guzeller guzeli 1tBeyoglunda gezersin 1tHarmandali 1tKurdili hicazcar sirto 1tNihavent longa1 aCent mélodies célèbres d'Eyrope de l'Est 9363603aMélodiesyEurope de l'EstxPartitions36685333937355939318240 3114209a9.5 3674aM 9363602aToubianabMarc3668524220 1aFRbBLVc20071024 2aFRbBLVc20110222 3aFRbBLVc20140414 aDKb ** c1 f706254w2014-10-1860991737cBLV20k9.5 TOU52014-04-14n2014-11-15o0eMAVrPARm2014-10-1840bBLVzPôle Musique et Arts Vivants \ No newline at end of file diff --git a/library/Class/Batch/IndexRessourcesNumeriques.php b/library/Class/Batch/IndexRessourcesNumeriques.php index 489c8f510b41c6851ced249b151abdd6a5417769..617cf7b1b4ac1e5f4b048a252c501857d666f91f 100644 --- a/library/Class/Batch/IndexRessourcesNumeriques.php +++ b/library/Class/Batch/IndexRessourcesNumeriques.php @@ -6,9 +6,19 @@ class Class_Batch_IndexRessourcesNumeriques extends Class_Batch_Abstract { } public function run() { - $albums = Class_Album::findAll(); - foreach ($albums as $album) - $album->index(); + $current_page = -1; + do { + $albums = Class_Album::findAllBy(['limitPage' => [$current_page += 1, + 100]]); + foreach ($albums as $album) + $album->index(); + + Class_Album::clearCache(); + Class_AlbumRessource::clearCache(); + Class_Notice::clearCache(); + Class_Exemplaire::clearCache(); + } while(count($albums) > 0); + (new Storm_Cache())->clean(); } diff --git a/library/Class/WebService/BibNumerique/Cyberlibris/LivresNumeriquesReader.php b/library/Class/WebService/BibNumerique/Cyberlibris/LivresNumeriquesReader.php index 91db13fc46bcfcbddef956ef7a6d461721c9907e..5705533f17f3c71bf9cab7c2197b6d6c11c232b7 100644 --- a/library/Class/WebService/BibNumerique/Cyberlibris/LivresNumeriquesReader.php +++ b/library/Class/WebService/BibNumerique/Cyberlibris/LivresNumeriquesReader.php @@ -16,11 +16,11 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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 Class_WebService_BibNumerique_Cyberlibris_LivresNumeriquesReader extends Class_WebService_DublinCoreParser { +class Class_WebService_BibNumerique_Cyberlibris_LivresNumeriquesReader extends Class_WebService_DublinCoreParser { protected $_total_count; protected $_page_number; protected $_page_size; diff --git a/library/Class/WebService/BibNumerique/RessourceNumerique.php b/library/Class/WebService/BibNumerique/RessourceNumerique.php index e211706d78a4f01311e9d7b6814f39397e5f57d6..4b2d7581e9033d63a935c2632e9e731f8ca356ea 100644 --- a/library/Class/WebService/BibNumerique/RessourceNumerique.php +++ b/library/Class/WebService/BibNumerique/RessourceNumerique.php @@ -16,11 +16,11 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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 Class_WebService_BibNumerique_RessourceNumerique { - + protected $_id; protected $_title; protected $_description; @@ -180,7 +180,7 @@ public function getPhotos() { return $this->_photos; } - + public function getMatieres() { return implode($this->_matieres,'::'); @@ -209,7 +209,7 @@ public function importMatieres($album) { $ids=[]; $indexation = new Class_Indexation(); - foreach ($this->_matieres as $matiere_libelle) { + foreach ($this->_matieres as $matiere_libelle) { if ( $matiere=Class_CodifMatiere::findFirstBy(['libelle' => $matiere_libelle])) { $ids[]=$matiere->getId(); continue; @@ -220,7 +220,7 @@ $matiere->setCodeAlpha($indexation->alphaMaj($matiere_libelle)); $matiere->save(); $ids[]=$matiere->getId(); - + } if ($ids) $album->setMatiere(implode(';',$ids)); @@ -240,7 +240,7 @@ ->setUrlOrigine($this->getBaseUrl()) ->setCategorie($categorie) ->setRessources($this->getRessources()); - + $this->importMatieres($album); @@ -252,6 +252,8 @@ if ($album->save()) Class_WebService_BibNumerique_Vignette::getInstance()->updateAlbum($album); + Class_Album::clearCache(); + Class_AlbumRessource::clearCache(); return $album; } @@ -263,7 +265,7 @@ ->findFirstBy(array('libelle' => $libelle, 'parent_id' => 0)); - if (null != $category) + if (null != $category) return $category; $category = Class_AlbumCategorie::newInstance(['libelle' => $libelle]); @@ -291,10 +293,10 @@ foreach ($this->_trailers as $url) $album->addTrailerUri($url); - + foreach ($this->_photos as $url) $album->addPhotoUri($url); - + $album->setExternalUri($this->getExternalUri()); return $this; } @@ -314,7 +316,7 @@ public function getRessourceCategorieLibelle(){} public function getBaseUrl() {} - + public function setOaiId($id) { if (!$id) diff --git a/library/Class/WebService/SIGB/Carthame.php b/library/Class/WebService/SIGB/Carthame.php index 5e2034ee13ee77b5561fb9b1c82974faad03c93b..b46e780c0c9609f7355cf10f63400d3d7af07bb2 100644 --- a/library/Class/WebService/SIGB/Carthame.php +++ b/library/Class/WebService/SIGB/Carthame.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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 Class_WebService_SIGB_Carthame { @@ -25,8 +25,9 @@ class Class_WebService_SIGB_Carthame { public static function getService($params){ if (!isset(self::$service)) { self::$service = Class_WebService_SIGB_Carthame_Service::getService( - $params['url_serveur'], - isset($params['key']) ? $params['key'] : null); + $params['url_serveur'], + isset($params['key']) ? $params['key'] : null, + isset($params['sigb_field_name'])? $params['sigb_field_name'] : 'ktm'); } return self::$service; diff --git a/library/Class/WebService/SIGB/Carthame/Service.php b/library/Class/WebService/SIGB/Carthame/Service.php index 5aa8e37c39a3f66f9d023b08b82c17221428313e..5c29a544719c2195197254d1d359c9cc1db7e504 100644 --- a/library/Class/WebService/SIGB/Carthame/Service.php +++ b/library/Class/WebService/SIGB/Carthame/Service.php @@ -16,23 +16,25 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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 Class_WebService_SIGB_Carthame_Service extends Class_WebService_SIGB_AbstractRESTService { protected $_key; protected $_translate; protected $_hold_error_messages; + protected $_sigb_field_name = "ktm"; /** * @param string $server_root * @return Class_WebService_SIGB_Carthame_Service */ - public static function getService($server_root, $key) { + public static function getService($server_root, $key = null, $sigb_field_name="ktm") { return self::newInstance() ->setServerRoot($server_root) ->setKey($key) - ->setTranslate(Zend_Registry::get('translate')); + ->setTranslate(Zend_Registry::get('translate')) + ->setSigbFieldName($sigb_field_name); } @@ -46,8 +48,8 @@ class Class_WebService_SIGB_Carthame_Service extends Class_WebService_SIGB_Abstr } - /** - * @param $translate Zend_Translate + /** + * @param $translate Zend_Translate * @return self */ public function setTranslate($translate) { @@ -55,18 +57,24 @@ class Class_WebService_SIGB_Carthame_Service extends Class_WebService_SIGB_Abstr return $this; } + public function setSigbFieldName($sigb_field_name) { + $this->_sigb_field_name=$sigb_field_name; + return $this; + } /** * @param Class_Users $user * @return Class_WebService_SIGB_Emprunteur */ public function getEmprunteur($user) { - $userId = $this->_authenticate($user); + if (!$userId = $this->_authenticate($user)) + return Class_WebService_SIGB_Emprunteur::nullInstance(); $xml = $this->_callAction('accountDetails', ['userid' => $userId]); - $account = Class_WebService_SIGB_Carthame_AccountResponseReader::newInstance() ->getAccountFromXml($xml); - + if ($account) + $account->setPassword($user->getPassword()) + ->beValid(); return $account->setId($userId) ->setService($this); } @@ -153,6 +161,8 @@ class Class_WebService_SIGB_Carthame_Service extends Class_WebService_SIGB_Abstr protected function _authenticate($user) { $response = $this->_callAction('login', ['username'=> (string)$user->getLogin(), 'password'=> (string)$user->getPassword()]); + if ($this->_getTagData($response, 'error')) + return false; return $this->_getTagData($response, 'id'); } @@ -163,7 +173,7 @@ class Class_WebService_SIGB_Carthame_Service extends Class_WebService_SIGB_Abstr * @return string */ protected function _callAction($action, $params=[]) { - $options = ['sigb' => 'ktm', + $options = ['sigb' => $this->_sigb_field_name, 'version' => 'standalone']; if ($this->_key) $options['idclient'] = $this->_key; diff --git a/library/ZendAfi/View/Helper/Notice/Entete.php b/library/ZendAfi/View/Helper/Notice/Entete.php index 55f03b7c897bfdb7675cfebf2323c3bfad0ded67..71824307f21a81928564fc468ab793c281dc5a53 100644 --- a/library/ZendAfi/View/Helper/Notice/Entete.php +++ b/library/ZendAfi/View/Helper/Notice/Entete.php @@ -56,27 +56,33 @@ class ZendAfi_View_Helper_Notice_Entete extends Zend_View_Helper_HtmlElement { } public function getValeurs($notice, $entetes) { - $values = []; - $facettes = $notice->getFacettes(); - array_walk( - $entetes, - function($item) use (&$values, $facettes, $notice) { - $label = Class_Codification::getInstance()->getNomChamp($item, 1); - $values[$label] = $notice->getChampNotice($item, $facettes); + $values = []; + $facettes = $notice->getFacettes(); + array_walk( + $entetes, + function($item) use (&$values, $facettes, $notice) { + $label = Class_Codification::getInstance()->getNomChamp($item, 1); + $champ_notice = $notice->getChampNotice($item, $facettes); + if ($champ_notice) { + $values[] = [ + 'label' => $label, + 'champ' => $champ_notice, + ]; + } }); - return array_filter($values); + return array_filter($values); } public function libellesValeursToHtmlAndSerie($libelles_valeurs,$notice){ $html = $this->addSeries($notice).'<dl>'; $i=0; - foreach($libelles_valeurs as $libelle => $valeur){ + foreach($libelles_valeurs as $item){ $class = is_odd($i) ? 'second' : 'first' ; $html.= - '<dt class="'.$class.' '.str_replace('é','e',strtolower(str_replace(['(',')'], '',$libelle))).'">'.$libelle.'</dt>'. - '<dd class="'.$class.'">'.$this->getValeurHtml($valeur).'</dd>'; + '<dt class="'.$class.' '.str_replace('é','e',strtolower(str_replace(['(',')'], '',$item['label']))).'">'.$item['label'].'</dt>'. + '<dd class="'.$class.'">'.$this->getValeurHtml($item['champ']).'</dd>'; $i++; } diff --git a/library/ZendAfi/View/Helper/Notice/Exemplaires.php b/library/ZendAfi/View/Helper/Notice/Exemplaires.php index 8fd6d5bd8acc67061cbc675c8684bc3a2efd3c0a..3cd46d0567a4e3eafe755474c1dba3ab1f44668e 100644 --- a/library/ZendAfi/View/Helper/Notice/Exemplaires.php +++ b/library/ZendAfi/View/Helper/Notice/Exemplaires.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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_View_Helper_Notice_Exemplaires extends Zend_View_Helper_HtmlElement { use Trait_Translator; @@ -32,10 +32,11 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends Zend_View_Helper_HtmlElemen // Recup des donnees de dispo et reservable $cls_comm = null; - if ($preferences["grouper"] == 1) { + xdebug_break(); +// if ($preferences["grouper"] == 1) { $cls_comm = new Class_CommSigb(); $exemplaires = $cls_comm->getDispoExemplaires($exemplaires); - } +// } $cote_libelle = $this->_('Cote').$this->editionLabelle($exemplaires); @@ -61,7 +62,7 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends Zend_View_Helper_HtmlElemen { // Infos bib $bib=fetchEnreg("select LIBELLE,GOOGLE_MAP,INTERDIRE_RESA from bib_c_site where ID_SITE=".$ex["id_bib"]); - + // html $html.='<tr>'; $html.='<td class="num">'.++$num.'</td>'; @@ -94,19 +95,19 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends Zend_View_Helper_HtmlElemen if($preferences["localisation"]==1) { $html.='<td class="localisation" style="text-align:center">'; - - if(!isset($controle[$ex["id_bib"]])) + + if(!isset($controle[$ex["id_bib"]])) $controle[$ex["id_bib"]]=fetchOne("select count(*) from bib_localisations where ID_BIB=".$ex["id_bib"]); - + $onclick="localisationExemplaire(this,".$ex["id_bib"].",'".$ex["cote"]."','".$ex["code_barres"]."')"; - if($controle[$ex["id_bib"]]>0) + if($controle[$ex["id_bib"]]>0) $html.= sprintf('<img src="%s" border="0" title="%s" style="cursor:pointer" onclick="%s" alt="%s" />', URL_ADMIN_IMG.'picto/localisation.png', $this->_('Situer cet exemplaire dans la bibliothèque'), $onclick, $this->_('Situer en exemplaire')); - else + else $html.=' '; $html.='</td>'; } @@ -114,7 +115,7 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends Zend_View_Helper_HtmlElemen if($preferences["plan"]==1) { $html.='<td class="gmap" style="text-align:center;">'; - if($bib["GOOGLE_MAP"] > "") + if($bib["GOOGLE_MAP"] > "") $html .= sprintf('<a href="%s"><img src="%s" border="0" alt="%s" title="%s" /></a>', BASE_URL.'/bib/mapview?id_bib='.$ex["id_bib"].'&retour=notice', URL_ADMIN_IMG.'picto/map.gif', @@ -159,7 +160,7 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends Zend_View_Helper_HtmlElemen $html.='</div>'; $html.='<div class="exemplaires_oeuvre" style="display:none"><img src="'.URL_IMG.'patience.gif"></div>'; } - + // Pour afficher la localisation sur le plan $html.='<div id="plan_localisation" style="display:none"></div>'; @@ -190,7 +191,7 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends Zend_View_Helper_HtmlElemen 'id_profil' => Class_Profil::getCurrentProfil()->getId()], null, true), - $this->view->tagImg(URL_ADMIN_IMG.'ico/edit.gif',['title' => $this->view->_('Modifier la configuration du tableau des exemplaires')]), + $this->view->tagImg(URL_ADMIN_IMG.'ico/edit.gif',['title' => $this->view->_('Modifier la configuration du tableau des exemplaires')]), ['data-popup' => 'true', 'style' => 'position: absolute']); } diff --git a/library/storm b/library/storm index 5bf95f81fc338fda2f1dda1dd3cf426671dc4fdb..ebb7cc30794f89861f3a75380eb70517b4cce827 160000 --- a/library/storm +++ b/library/storm @@ -1 +1 @@ -Subproject commit 5bf95f81fc338fda2f1dda1dd3cf426671dc4fdb +Subproject commit ebb7cc30794f89861f3a75380eb70517b4cce827 diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index a6a5d8de8103e1c4a1f74cb891c002935edb17e6..865480066fd475d1e626f248565e43608ca3b971 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -441,7 +441,7 @@ class NoticeAjaxControllerExemplairesTest extends AbstractControllerTestCase { $mock_sql ->whenCalled('fetchAll') - ->with('Select id_notice,id_bib,cote,count(*) from exemplaires where id_notice=123 group by 1,2,3', + ->with('Select id_notice,id_bib,cote,count(*)id_int_bib_id_origine from exemplaires where id_notice=123 group by 1,2,3', false) ->answers($exemplaires); diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index 444d201894502f18afbec75994147b6ec497a886..31c072d018e2ab5fb94b460944c0b622c9c77faf 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -161,6 +161,8 @@ class RechercheControllerViewNoticeWithPreferencesTest extends RechercheControll Class_Notice::setTimeSource($time_source); Class_AdminVar::newInstanceWithId('FACETTE_GENRE_LIBELLE', ['valeur' => 'GENRES']); + Class_AdminVar::newInstanceWithId('FACETTE_DEWEY_LIBELLE', ['valeur' => 'Classification']); + Class_AdminVar::newInstanceWithId('FACETTE_PCDM4_LIBELLE', ['valeur' => 'Classification']); $this->notice->setClefChapeau('Gallimard serie'); $preferences = [ @@ -383,6 +385,14 @@ class RechercheControllerViewNoticeWithPreferencesTest extends RechercheControll public function barreNavShouldContainsCinemaAnimation() { $this->assertXPathContentContains('//div[@class="barre_nav"]//span', 'Cinéma d\'animation'); } + + /** @test */ + public function deweyAndPcdm4WithSameLibelleShouldBePresent() { + $this->assertXPathContentContains('//div[@class="entete_notice"]//dt[contains(@class, "classification")]', 'Classification'); + $this->assertXPathContentContains('//div[@class="entete_notice"]//dt[contains(@class, "classification")]/following::dd', 'Philosophie et disciplines connexes'); + $this->assertXPathContentContains('//div[@class="entete_notice"]//dt[contains(@class, "classification")]', 'Classification'); + $this->assertXPathContentContains('//div[@class="entete_notice"]//dt[contains(@class, "classification")]/following::dd', 'rock'); + } } diff --git a/tests/library/Class/WebService/SIGB/CarthameTest.php b/tests/library/Class/WebService/SIGB/CarthameTest.php index d2e99611c43a6dc69e987c351a261dcfbd08c09c..b7e0705b463141e76f980e3a5e1331799823f071 100644 --- a/tests/library/Class/WebService/SIGB/CarthameTest.php +++ b/tests/library/Class/WebService/SIGB/CarthameTest.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; 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 */ abstract class CarthameTestCase extends Storm_Test_ModelTestCase { @@ -24,13 +24,17 @@ abstract class CarthameTestCase extends Storm_Test_ModelTestCase { Class_WebService_SIGB_Carthame::reset(); parent::tearDown(); } + public function setUp() { + parent::setUp(); + } } class CarthameGetServiceTest extends CarthameTestCase { + protected $service; public function setUp() { parent::setUp(); - $this->service = Class_WebService_SIGB_Carthame::getService(['url_serveur' => 'http://ifr.ro/webservices/index.php']); + $this->service = Class_WebService_SIGB_Carthame::getService(['url_serveur' => 'http://ifr.ro/webservices/index.php', 'key' => 'bibkey', 'sigb_field_name' => 'karvi']); } @@ -63,24 +67,67 @@ abstract class CarthameOperationTestCase extends CarthameTestCase { ->answers('') ->getWrapper(); - $this->service = Class_WebService_SIGB_Carthame::getService(['url_serveur' => 'http://ifr.ro/webservices/index.php']) + $this->service = Class_WebService_SIGB_Carthame::getService(['url_serveur' => 'http://ifr.ro/webservices/index.php', 'key' => 'bibkey', 'sigb_field_name' => 'karvi']) ->setWebClient($this->mock_web_client); } } -class CarthameNoticeAlbatorTest extends CarthameOperationTestCase { + +class CarthameKtmNoticeAlbatorTest extends CarthameTestCase { + protected $mock_web_client; + protected $service; + /** @var Class_WebService_SIGB_Notice */ protected $albator; public function setUp() { parent::setUp(); + $this->mock_web_client = Storm_Test_ObjectWrapper::on(new Class_WebService_SimpleWebClient()) + ->whenCalled('open_url') + ->answers('') + ->getWrapper(); $this->mock_web_client ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=copyDetails&nn=I86355') + ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&idclient=bibkey&action=copyDetails&nn=I86355') ->answers(CarthameTestFixtures::createAnonymousNoticeXml()); + + + $this->service = Class_WebService_SIGB_Carthame::getService(['url_serveur' => 'http://ifr.ro/webservices/index.php', 'key' => 'bibkey']) + ->setWebClient($this->mock_web_client); + + $this->albator = $this->service->getNotice('I86355'); + } + + /** @test */ + public function shouldAnswerOneNotice() { + $this->assertInstanceOf('Class_WebService_SIGB_Notice', $this->albator); + } + + + /** @test */ + public function firstCopyGetDisponibiliteShouldReturnDisponible() { + $copies = $this->albator->getExemplaires(); + $this->assertEquals('Disponible', $copies[0]->getDisponibilite()); + } +} + + +class CarthameKarviNoticeAlbatorTest extends CarthameOperationTestCase { + /** @var Class_WebService_SIGB_Notice */ + protected $albator; + + public function setUp() { + parent::setUp(); + + $this->mock_web_client + ->whenCalled('open_url') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=copyDetails&nn=I86355') + ->answers(CarthameTestFixtures::createAnonymousNoticeXml()) + ->beStrict(); + $this->albator = $this->service->getNotice('I86355'); } @@ -108,7 +155,7 @@ class CarthameAnonymousNoticeTest extends CarthameOperationTestCase { $this->mock_web_client ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=copyDetails&nn=xxx') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=copyDetails&nn=xxx') ->answers(CarthameTestFixtures::createAnonymousNoticeXml()); $this->anonymous = $this->service->getNotice('xxx'); @@ -213,10 +260,10 @@ class CarthameEmprunteurPatrickBTest extends CarthameOperationTestCase { $this->mock_web_client->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=login&username=pbarroca&password=1974') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=login&username=pbarroca&password=1974') ->answers(CarthameTestFixtures::createEmprunteurPatrickBLoginXml()) ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=accountDetails&userid=3') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=accountDetails&userid=3') ->answers(CarthameTestFixtures::createEmprunteurPatrickBXml()) ; @@ -382,15 +429,15 @@ class CarthameOperationsTest extends CarthameOperationTestCase { public function reserverExemplaireShouldReturnSuccessIfNoError() { $this->mock_web_client ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=login&username=pbarroca&password=1974') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=login&username=pbarroca&password=1974') ->answers(CarthameTestFixtures::createEmprunteurPatrickBLoginXml()) - + ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=reserveInfo&userid=3&nn=Millenium') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=reserveInfo&userid=3&nn=Millenium') ->answers('<?xml version="1.0" encoding="utf-8"?> <root> <reservationInfo> - <sigb>KTM</sigb> + <sigb>KARVI</sigb> <user>16644</user> <nn>CL16028</nn> <site id="2" coche="luj-Napoca">=F</site> @@ -398,13 +445,13 @@ class CarthameOperationsTest extends CarthameOperationTestCase { <code>0</code> </reservationInfo> </root>') - + ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=reserveDocument&userid=3&nn=Millenium&site=2') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=reserveDocument&userid=3&nn=Millenium&site=2') ->answers('<?xml version="1.0"?> <root> <reservationDoc> - <sigb>ktm</sigb> + <sigb>karvi</sigb> <user>xxx</user> <nn>Millenium</nn> <infores>Millenium</infores> @@ -426,15 +473,15 @@ class CarthameOperationsTest extends CarthameOperationTestCase { public function reserverExemplaireInAnNotAllowedSiteShouldReturnAvailableSites() { $this->mock_web_client ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=login&username=pbarroca&password=1974') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=login&username=pbarroca&password=1974') ->answers(CarthameTestFixtures::createEmprunteurPatrickBLoginXml()) - + ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=reserveInfo&userid=3&nn=Millenium') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=reserveInfo&userid=3&nn=Millenium') ->answers('<?xml version="1.0" encoding="utf-8"?> <root> <reservationInfo> - <sigb>KTM</sigb> + <sigb>KARVI</sigb> <user>16644</user> <nn>CL16028</nn> <site id="3" coche="Iasi">Iasi</site> @@ -445,7 +492,7 @@ class CarthameOperationsTest extends CarthameOperationTestCase { </root>'); $this->assertEquals( - ['statut' => false, + ['statut' => false, 'erreur' => 'Réservation impossible. Autorisée seulement sur Iasi,Timisoara'], $this->service->reserverExemplaire($this->_user, $this->_exemplaire_millenium, @@ -464,15 +511,15 @@ class CarthameOperationsTest extends CarthameOperationTestCase { public function assertReserveInfoMessageIs($code, $message) { $this->mock_web_client ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=login&username=pbarroca&password=1974') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=login&username=pbarroca&password=1974') ->answers(CarthameTestFixtures::createEmprunteurPatrickBLoginXml()) ->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=reserveInfo&userid=3&nn=Millenium') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=reserveInfo&userid=3&nn=Millenium') ->answers('<?xml version="1.0"?> <root> <reservationInfo> - <sigb>ktm</sigb> + <sigb>karvi</sigb> <user>3</user> <nn>Millenium</nn> <error>1</error> @@ -484,7 +531,7 @@ class CarthameOperationsTest extends CarthameOperationTestCase { $this->assertEquals( ['statut' => false, 'erreur' => $message], - $this->service->reserverExemplaire($this->_user, + $this->service->reserverExemplaire($this->_user, $this->_exemplaire_millenium, '1') ); } @@ -499,11 +546,11 @@ class CarthameOperationsTest extends CarthameOperationTestCase { /** @test */ public function supprimerReservationShouldReturnSuccessIfNoError() { $this->mock_web_client->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=reserveCancel&resid=MillRes') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&action=reserveCancel&resid=MillRes') ->answers('<?xml version="1.0"?> <root> <reservationCancel> - <sigb>KTM</sigb> + <sigb>KARVI</sigb> <resid>MillRes</resid> <error>0</error> <code></code> @@ -521,11 +568,11 @@ class CarthameOperationsTest extends CarthameOperationTestCase { /** @test */ public function supprimerReservationShouldReturnErrorIfFail() { $this->mock_web_client->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=reserveCancel&resid=HarrRes') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=reserveCancel&resid=HarrRes') ->answers('<?xml version="1.0"?> <root> <reservationCancel> - <sigb>KTM</sigb> + <sigb>KARVI</sigb> <resid>HarrRes</resid> <error>-1</error> <code>Error from WS</code> @@ -542,11 +589,11 @@ class CarthameOperationsTest extends CarthameOperationTestCase { /** @test */ public function prolongerPretShouldReturnSuccessIfNoError() { $this->mock_web_client->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=prolongLoan&loanid=Millenium') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=prolongLoan&loanid=Millenium') ->answers('<?xml version="1.0"?> <root> <prolongation> - <sigb>ktm</sigb> + <sigb>karvi</sigb> <id>Millenium</id> <error>0</error> <code>0</code> @@ -564,11 +611,11 @@ class CarthameOperationsTest extends CarthameOperationTestCase { /** @test */ public function prolongerPretShouldReturnErrorIfFail() { $this->mock_web_client->whenCalled('open_url') - ->with('http://ifr.ro/webservices/index.php?sigb=ktm&version=standalone&action=prolongLoan&loanid=095124224') + ->with('http://ifr.ro/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=prolongLoan&loanid=095124224') ->answers('<?xml version="1.0"?> <root> <prolongation> - <sigb>ktm</sigb> + <sigb>karvi</sigb> <id>095124224</id> <error>1</error> <code>Error from WS</code> @@ -598,7 +645,8 @@ class CarthameKarviTest extends CarthameTestCase { $this->service = Class_WebService_SIGB_Carthame::getService( ['url_serveur' => 'http://ifr.ro/webservices/index.php', - 'key' => 'MyClientId']) + 'key' => 'MyClientId', + 'sigb_field_name' => 'karvi']) ->setWebClient($this->mock_web_client); $this->_user = Class_Users::newInstance() @@ -626,8 +674,8 @@ class CarthameKarviTest extends CarthameTestCase { /** @test */ public function reserverExemplaireRequestShouldContainMyClientId() { - $this->service->reserverExemplaire($this->_user, - $this->_exemplaire_millenium, + $this->service->reserverExemplaire($this->_user, + $this->_exemplaire_millenium, 'Institut F'); $this->assertQueryContains('MyClientId'); } @@ -724,7 +772,7 @@ class CarthameTestFixtures { return '<?xml version="1.0"?> <root> <login> - <sigb>ktm</sigb> + <sigb>karvi</sigb> <user>80001</user> <id>3</id> <email/>