diff --git a/VERSIONS b/VERSIONS index a2c493099b3fe0d53c90f953cd2b6ad398692bb6..a9e52bb0aaf51338b3a5679b8fffcd816e9fe6ea 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,43 @@ +- ticket #14279: Cosmogramme: import de bibliothèques multiples depuis un seul export unimarc + ** Avant ** + Prenons le cas d'un réseau avec un SIGB qui gère plusieurs médiathèques (or Nanook). Nous aurons un fichier d'export contenant des exemplaires de plusieurs bibliothèques. Or Cosmogramme jusqu'à présent ne savait pas classer les exemplaires par bibliothèque mais par annexe. C'est à dire qu'à partir d'un champ 995 (ex: 995$y) qui contient un code bibliothèque, nous définissions des annexes avec un code unique chacune pour y placer les exemplaires. Toutes les annexes appartenant à UNE MEME bibliothèque qui est celle du SIGB. + + Dans un réseau avec un seul SIGB, cela nous donnait par exemple: + - une seule bibliothèque + - plusieurs annexes + - une seule intégration programmée (imports total + incrémentiel, abonnés) pour tout le réseau + + Ce qui amène comme problèmes: + - l'OPAC considère qu'il n'y a qu'une seule bibliothèque + - impossible d'utiliser + - les fonctions de localisation des exemplaires + - recherche géographique + - impossible de mixer un SIGB qui gèrent plusieurs bibliothèques (1 seul export) avec des SIGB qui n'en gèrent qu'une (exports multiples). + + + D'un côté nous utilisions les annexes pour intégrer les catalogues de réseau (Orphée, Aloes, Karvi, Koha, ...), de l'autre nous configurions Nanook pour faire comme si il y'avait plusieurs SIGB indépendants alors qu'en réalité il n'y en a qu'un (Nanook fait un export par bibliothèque, on configure X web services identiques). + + Techniquement, chaque exemplaire est rattaché à une annexe (et donc une bibliothèque). Une bibliothèque est rattachée à une intégration programmée et donc un SIGB. On a donc 1 bibliothèque = 1 SIGB. L'objectif du développement a été de faire sauter cette limitation. + + + ** Après ** + Chaque exemplaire est toujours rattaché à une annexe et une bibliothèque. Mais il est maintenant rattaché à une intégration programmée directement, le lien SIGB / bibliothèque étant supprimé. Le fonctionnement est le suivant: + + - une bibliothèque Tombouctou avec une annexe "Tombouctou" code T + - une bibliothèque Tataouine avec une annexe "Tatouine" code O et une annexe "Grenier" code G + - une intégration programmée pour un seul SIGB, code annexe en 995$y + + Les exemplaires avec code T sont rattachés à Tombouctou, les exemplaires avec code O et G sont rattachés à Tataouine. Tous les exemplaires sont reliés au SIGB pour assurer les web services et les mises à jour (import incrémentiel + suppression des exemplaires). Les annexes servent donc aussi de règles de reconnaissance (à l'instar des genres) pour placer les exemplaires dans les bonnes bibliothèques. + + Le paramètre "unicité des code barres" pour dédoublonner les exemplaires en mode "code barre + bib" se base non plus sur la bibliothèque mais l'intégration programmée / SIGB. + + A noter qu'on garde la compatibilité avec le fonctionnement existant. Si un réseau utilisant Aloes / Orphee / Dynix / ... en profiter, il faudra reconfigurer Cosmogramme en conséquence et faire un export total. + + + ** Plus tard ** + Une limitation actuelle est que pour TOUS les SIGB, le code annexe / bib doit être unique. Si pour un SIGB le code A correspond à une bibliothèque et pour un autre SIGB le code A correspond à une autre bibliothèque, c'est mort. Une solution semble de rajouter un paramètre aux annexes pour choisir à quelle intégration programmée elle se rattache. A faire si un jour on tombe dans ce cas. + + 22/08/2014 - v6.50.1 - ticket #15519: Cyberlibris: validation du SSO Cyberlibris depuis une page notice @@ -33,6 +73,7 @@ + 04/08/2014 - v6.49.0 - ticket #12992: Champs personnalisés @@ -132,7 +173,6 @@ SIGB Nanook - création d'une url unique d'accès à Numérique Premium convenant au processus d'authentification de ce service - récupération des vignettes lors du moissonnage ->>>>>>> afi-master 26/06/2014 - v6.46.3 - ticket #14515: Autorise l'utilisation de fichiers de police au format OTF diff --git a/cosmogramme/php/_init.php b/cosmogramme/php/_init.php index e6e0b1850c817411add8456be44742d1aa753b48..5e21c4c6ddc15baafbbac8c6f230243f3f3e901c 100644 --- a/cosmogramme/php/_init.php +++ b/cosmogramme/php/_init.php @@ -2,7 +2,7 @@ // Constantes error_reporting(E_ERROR | E_PARSE); define("VERSION_COSMOGRAMME","6.55"); -define("PATCH_LEVEL","212"); +define("PATCH_LEVEL","213"); define("APPLI","cosmogramme"); define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs"); @@ -21,7 +21,7 @@ define('COM_BIBLIXNET', 10); define('COM_DYNIX', 11); $basePath = dirname(realpath(__FILE__)); -set_include_path(get_include_path() +set_include_path(get_include_path() . PATH_SEPARATOR . $basePath . PATH_SEPARATOR . $basePath . '/classes/'); diff --git a/cosmogramme/php/classes/classe_bib.php b/cosmogramme/php/classes/classe_bib.php index 12e2f7cbfbb76efab0dad1b189291b7738e71679..b9520eaa261c93c38acbf6d8e273514f2d19bc72 100644 --- a/cosmogramme/php/classes/classe_bib.php +++ b/cosmogramme/php/classes/classe_bib.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 */ //////////////////////////////////////////////////////////////////////////////////////// // FICHE BIBLIOTHEQUE @@ -34,7 +34,7 @@ class bibliotheque $bibs=$sql->fetchAll("select * from int_bib ".$where."order by nom_court"); return $bibs; } - + //--------------------------------------------------------------------------------- // Rend le nom court d'1 bib //--------------------------------------------------------------------------------- @@ -70,9 +70,9 @@ class bibliotheque else $ecart.=" jours"; } $lig=$bib; - if(!$lig["date_mail"]) $lig["date_mail"]="jamais"; + if(!$lig["date_mail"]) $lig["date_mail"]="jamais"; $lig["retard"]=$ecart; - $ret[]=$lig; + $ret[]=$lig; } } return $ret; @@ -81,14 +81,16 @@ class bibliotheque //--------------------------------------------------------------------------------- // Rend une combo avec les noms courts //--------------------------------------------------------------------------------- - public function getComboNoms($id_a_selectionner=0) - { - $bibs=$this->getAll(); + public function getComboNoms($id_a_selectionner=0) { + $bibs = Class_IntBib::findAll(); + + usort($bibs, function($a, $b) {return $a->getLabel() > $b->getLabel();}); + $combo='<select name="id_bib">'; foreach($bibs as $bib) { - if($id_a_selectionner == $bib["id_bib"]) $selected=" selected"; else $selected=""; - $combo.='<option value="'.$bib["id_bib"].'"'.$selected.'>'.stripSlashes($bib["nom_court"]).'</option>'; + $selected = ($id_a_selectionner == $bib->getIdBib()) ? " selected=\"selected\"" : ""; + $combo.='<option value="'.$bib->getIdBib().'"'.$selected.'>'.stripSlashes($bib->getLabel()).'</option>'; } $combo.='</select>'; return $combo; diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 0ccd7678adc2acaa2aa76ccbc8a82ecad3d68836..e185a12d475e8ae21c2faa7af292dab56aa06c7a 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -36,7 +36,8 @@ class notice_integration private $type_doc_force; // Type de document forcé dans maj_auto private $analyseur; // Instance de la classe qui découpe la notice private $indexation; // Instance de la classe d'indexation - private $id_bib; // Bibliotheque pour qui on integre + private $id_bib; // Bibliotheque pour qui on integre @deprecated, see below setParamsIntegration + private $id_int_bib; // Intégration programmée pour qui on integre private $type_operation; // Maj ou suppression private $notice; // Structure notice en cours de traitement private $qualite_bib; // Code qualite de la bib @@ -69,7 +70,11 @@ class notice_integration function setParamsIntegration($id_bib,$type_operation,$id_profil,$type_doc_force="") { global $sql; - $this->id_bib=$id_bib; + /** + * $this->id_bib is deprecated, use $this->id_int_bib instead. + * @see http://forge.afi-sa.fr/issues/14279 + */ + $this->id_bib=$this->id_int_bib=$id_bib; $this->type_operation=$type_operation; $this->type_doc_force=$type_doc_force; @@ -400,6 +405,7 @@ class notice_integration $numero = ''; foreach($champs as $champ) { $table_champs[] = [$champ['code'], $champ['valeur']]; + if ($champ['code'] != $champ_numero) continue; @@ -409,7 +415,7 @@ class notice_integration $champ['valeur'] = substr($champ['valeur'],$i); break; } - } + } $trav = explode(' ', $champ['valeur']); $numero = $trav[0]; } @@ -443,8 +449,6 @@ class notice_integration private function chercheNotice() { global $sql; - xdebug_break(); - $id_bib = $this->id_bib; if(!$this->mode_doublon) { $isbn10=$this->notice["isbn10"]; @@ -459,7 +463,7 @@ class notice_integration { $unicite_codes_barres=getVariable("unicite_code_barres"); if($unicite_codes_barres=="1") $condition=""; - else $condition='id_bib='.$id_bib.' and '; + else $condition='id_int_bib='.$this->id_int_bib.' and '; foreach($this->notice["exemplaires"] as $ex) { $code_barres=$ex["code_barres"]; @@ -549,9 +553,10 @@ class notice_integration // Traitement des facettes $this->traiteFacettes(); - $id_notice=$sql->insert("notices", $this->noticeToDBEnreg($this->notice)); + $notice = Class_Notice::newInstance($this->noticeToDBEnreg($this->notice)); + $notice->save(); $this->statut=1; - return $id_notice; + return $notice->getId(); } @@ -706,57 +711,73 @@ class notice_integration private function ecrireExemplaires($id_notice) { - global $sql; - $id_bib = $this->id_bib; - $to_insert = []; - - $unicite_codes_barres = getVariable('unicite_code_barres'); - $condition_bib = ($unicite_codes_barres == '1') ? '' : ' and id_bib=' . $id_bib; $code_barres = []; + $exemplaires = []; foreach ($this->notice['exemplaires'] as $ex) { - $code_barres []= '\'' . $ex['code_barres'] . '\''; + $code_barres []= $ex['code_barres']; if ($ex["activite"]=="d") continue; - $data = $ex; - $data['id_notice'] = $id_notice; - $data['id_bib'] = $id_bib; - $data['id_origine'] = $this->notice['id_origine']; - $to_insert[] = $data; + $exemplaire = Class_Exemplaire::newInstance($ex) + ->setIdNotice($id_notice) + ->setIdOrigine($this->notice['id_origine']) + ->setIdBib($this->id_bib) + ->setIdIntBib($this->id_int_bib); + + /** + * @see http://forge.afi-sa.fr/issues/14279 + * we can have one file with items for different libraries. We use "annexe" codification to find + * to put each item in the library it belongs to. + **/ + if ($exemplaire->hasAnnexe() && ($annexe = Class_CodifAnnexe::findFirstBy(['code' => $ex['annexe']]) ) ) { + $exemplaire->setIdBib($annexe->getIdBib()); + } + + $exemplaires []= $exemplaire; } if (!empty($code_barres)) { - $req_delete = 'delete from exemplaires where id_notice=' . $id_notice . $condition_bib . ' and code_barres in (' . implode(',', $code_barres) . ')'; - $sql->execute($req_delete); + $unicite_codes_barres = getVariable('unicite_code_barres'); + $delete_duplicates_args = ($unicite_codes_barres == '1') ? [] : ['id_int_bib' => $this->id_int_bib]; + $delete_duplicates_args['id_notice'] = $id_notice; + $delete_duplicates_args['code_barres'] = $code_barres; + Class_Exemplaire::deleteBy($delete_duplicates_args); } - foreach($to_insert as $data) - $sql->insert('exemplaires', $data); + foreach($exemplaires as $exemplaire) + $exemplaire->save(); + + Class_Notice::find($id_notice) + ->setDateMaj(dateDuJour(2)) + ->save(); - $date_maj = dateDuJour(2); - $sql->execute("update notices set date_maj='$date_maj' where id_notice=$id_notice"); + Class_Exemplaire::clearCache(); + Class_Notice::clearCache(); } - private function supprimerExemplaire($id_notice,$ex) { - if(!$id_notice) - { + public function supprimerExemplaire($id_notice,$ex) { + if(!$id_notice) { $this->statut=0; - $this->erreur="notice de l\'exemplaire à supprimer non trouvée"; + $this->erreur="notice de l'exemplaire à supprimer non trouvée"; return false; } - global $sql; - $id_bib=$this->id_bib; - $code_barres=$ex["code_barres"]; - $ret=$sql->execute( "delete from exemplaires where id_notice=$id_notice and id_bib=$id_bib and code_barres='$code_barres'"); - if(!$ret) - { + + $exemplaires = Class_Exemplaire::findAllBy(['id_notice' => $id_notice, + 'id_int_bib' => $this->id_int_bib, + 'code_barres' => $ex['code_barres']]); + if(!$exemplaires) { $this->statut=0; $this->erreur="code-barres à supprimer non trouvé"; return false; } - $date_maj=dateDuJour(2); - $sql->execute("update notices set date_maj='$date_maj' where id_notice=$id_notice"); + + + foreach($exemplaires as $exemplaire) + $exemplaire->delete(); + + Class_Notice::find($id_notice)->setDateMaj(dateDuJour(2)) + ->save(); } @@ -1311,4 +1332,4 @@ class notice_integration } } -?> \ No newline at end of file +?> diff --git a/cosmogramme/php/classes/classe_parseur.php b/cosmogramme/php/classes/classe_parseur.php index 467bce5b242e967eb9d86f690c5cd1670c557e6f..d458ead0d8f9d2ff898d92a982c88b2560a38c1c 100644 --- a/cosmogramme/php/classes/classe_parseur.php +++ b/cosmogramme/php/classes/classe_parseur.php @@ -133,9 +133,10 @@ class parseur { $fin_enreg = chr(30) . chr(29); $data = $this->buffer; $fileSystem = $this->getFileSystem(); + while(true) { - $pos = strScan($data,$fin_enreg,0); - if($pos > 0) { + $pos = strpos($data, $fin_enreg); + if(false !== $pos) { $this->buffer = substr($data, ($pos+2)); $data = substr($data, 0, ($pos+2)); break; diff --git a/cosmogramme/php/classes/classe_profil_donnees.php b/cosmogramme/php/classes/classe_profil_donnees.php index da219182e3be563a3d3a1496628c0220a4f6825c..d84a52d633c805d4d3261d443d36b6b00f8b375d 100644 --- a/cosmogramme/php/classes/classe_profil_donnees.php +++ b/cosmogramme/php/classes/classe_profil_donnees.php @@ -201,6 +201,7 @@ class profil_donnees //--------------------------------------------------------------------------------- public function getTypeDoc($label,$z995,$z995p) { + $typeDoc = ['code' => 0, 'libelle' => 'non identifié']; // Si 995$p est à p c'est un periodique if(strToUpper(trim($z995p[0]))=="P") { @@ -247,6 +248,7 @@ class profil_donnees } } } + return $typeDoc; } diff --git a/cosmogramme/php/classes/classe_unimarc.php b/cosmogramme/php/classes/classe_unimarc.php index 78e23b6c65a764a3187379294c022c8820d824e5..a0aaa7851c8f62225356dc170fa5429563f33c89 100644 --- a/cosmogramme/php/classes/classe_unimarc.php +++ b/cosmogramme/php/classes/classe_unimarc.php @@ -818,10 +818,9 @@ class notice_unimarc extends iso2709_record { $z995r = $this->get_subfield('996', 'x'); } - if($this->type_doc_force['label'] > '') - $typeDoc['code'] = $this->type_doc_force['code']; - else - $typeDoc = $this->profil_unimarc->getTypeDoc($label, $z995r, $z995p); + $typeDoc['code'] = ($this->type_doc_force['label'] > '') + ? $this->type_doc_force['code'] + : $this->profil_unimarc->getTypeDoc($label, $z995r, $z995p)['code']; if ($infos) { $ret["code"] = $typeDoc["code"]; diff --git a/cosmogramme/php/codif_annexe.php b/cosmogramme/php/codif_annexe.php index a70ba9abf0610a4677f15f10994aaece151d8bec..8c0808b2bf19d76d3350a6ea2b62755b2bbe357c 100644 --- a/cosmogramme/php/codif_annexe.php +++ b/cosmogramme/php/codif_annexe.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 */ /////////////////////////////////////////////////////////////////// // @@ -32,7 +32,7 @@ $cls_bib=new bibliotheque(); ?> <h1>Codification des annexes</h1> - + <?php //--------------------------------------------------------------------------------- @@ -50,7 +50,7 @@ if($_REQUEST["action"]=="CREER") // VALIDER //--------------------------------------------------------------------------------- if($_REQUEST["action"]=="VALIDER") -{ +{ // ecriture if(!isset($_POST["invisible"])) $_POST["invisible"]="0"; if(!isset($_POST["no_pickup"])) $_POST["no_pickup"]="0"; @@ -74,7 +74,7 @@ if($_REQUEST["action"]=="SUPPRIMER") } //--------------------------------------------------------------------------------- -// LISTE +// LISTE //--------------------------------------------------------------------------------- print('<div class="liste">'); @@ -122,7 +122,7 @@ function afficherAnnexe($annexe,$display) $inputId = 'no_pickup_' . $annexe['id_annexe']; print('<tr><td class="form_first" align="right" width="35%"><label for="' . $inputId . '">Exclu du PEB </label></td>' .'<td class="form_first"><input id="' . $inputId . '" type="checkbox" value="1" '.$checked.' name="no_pickup"></td></tr>'); - + // Boutons maj print('<tr><th class="form" colspan="2" align="center">'); $bouton_valider='<input type="submit" class="bouton" value="Valider">'; diff --git a/cosmogramme/sql/patch/patch_213.sql b/cosmogramme/sql/patch/patch_213.sql new file mode 100644 index 0000000000000000000000000000000000000000..cbe8b4bff1dfb07ff508bab8ef1bb08742aa8869 --- /dev/null +++ b/cosmogramme/sql/patch/patch_213.sql @@ -0,0 +1,3 @@ +alter table exemplaires add column id_int_bib int not null default 0; +alter table exemplaires add index (id_int_bib); +update exemplaires set id_int_bib=id_bib; diff --git a/cosmogramme/tests/php/classes/BibTest.php b/cosmogramme/tests/php/classes/BibTest.php new file mode 100644 index 0000000000000000000000000000000000000000..645cfcd889ece49ca57c3927b8e82ae0ab69da13 --- /dev/null +++ b/cosmogramme/tests/php/classes/BibTest.php @@ -0,0 +1,56 @@ +<?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 'classe_bib.php'; + +class BibTest extends Storm_Test_ModelTestCase { + protected $_html; + + public function setUp() { + parent::setUp(); + $this->fixture('Class_IntBib', ['id' => 3, + 'nom' => null, + 'nom_court' => 'An', + 'bib' => $this->fixture('Class_Bib', ['id' => 3, + 'libelle' => 'Annecy'])]); + + $this->fixture('Class_IntBib', ['id' => 4, + 'nom' => null, + 'nom_court' => 'Cran']); + + $this->_html = (new bibliotheque())->getComboNoms(3); + } + + /** @test */ + public function combosNomsShouldAnswerAnnecySelected() { + $this->assertContains('<option value="3" selected="selected">Annecy</option>', + $this->_html); + } + + + /** @test */ + public function combosNomsShouldAnswerCranNotSelected() { + $this->assertContains('<option value="4">Cran</option>', + $this->_html); + } +} +?> \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index f129decc012ad9aae70194b480271c61c19e033d..17d843ea2fc91617ea56862b6b8235a4761192cf 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -231,7 +231,6 @@ abstract class NoticeIntegrationSacramentariumTestCase extends NoticeIntegration $this->notice_integration = new notice_integration(); $this->pseudo_notice = $this->notice_integration->traitePseudoNotice(100, - $this->sacramentarium->rawToArray()); $this->notice_sgbd->ouvrirNotice($this->pseudo_notice['unimarc'], 0); } @@ -239,7 +238,7 @@ abstract class NoticeIntegrationSacramentariumTestCase extends NoticeIntegration protected function assertFacettesContains($value) { $this->assertTrue(false !== strpos($this->pseudo_notice['facettes'], $value), - 'Failed asserting that facettes CONTAINS [' . $value . ']'); + 'Failed asserting that facettes CONTAINS [' . $value . ']'); } } @@ -262,7 +261,7 @@ class NoticeIntegrationSacramentariumParsingTest extends NoticeIntegrationSacram /** @test */ public function titreShouldBeSacramentarium() { $this->assertEquals('MS 14 - Sacramentarium ad usum Sylviniacensem', - $this->notice_sgbd->get_subfield("200", "a")[0]); + $this->notice_sgbd->get_subfield("200", "a")[0]); } @@ -357,14 +356,14 @@ class NoticeIntegrationLollipopGeneratedNoticeRecordTest extends NoticeIntegrati /** @test */ public function noticeDbEnregTitresShouldBeLollipopAndLolipop() { $this->assertEquals('LOLLIPOP LOLIPOP', - $this->notice_integration->noticeToDBEnreg($this->notice_data)['titres']); + $this->notice_integration->noticeToDBEnreg($this->notice_data)['titres']); } /** @test */ public function noticeDbEnregEditeurShouldBeEcoleEkolLoisirsLoisir() { $this->assertEquals('ECOLE EKOL LOISIRS LOISIR', - $this->notice_integration->noticeToDBEnreg($this->notice_data)['editeur']); + $this->notice_integration->noticeToDBEnreg($this->notice_data)['editeur']); } } @@ -384,7 +383,6 @@ abstract class NoticeIntegrationMarc21ToUnimarcTest extends NoticeIntegrationTes $this->assertEquals(['Titre général ;', 'titre general ;'], $this->notice_sgbd->get_subfield('461', 't')); } - /** @test */ public function zone461TInMarc21ShouldContainsTitres() { $this->assertEquals(['Titre général ;', 'titre general ;'], $this->notice_marc21->get_subfield('461', 't')); @@ -586,16 +584,10 @@ class NoticeIntegrationMussoWithoutRenvoisTest extends NoticeIntegrationTestCase class NoticeIntegrationBienveillantesTest extends NoticeIntegrationTestCase { - protected $_profil_donnees = - ['id_profil' => 111, - 'libelle' => 'UNIMARC ALOES', - 'accents' => '1', - 'rejet_periodiques' => '0', - 'id_article_periodique' => '2', - 'type_fichier' => '0', - 'format' => '0', - 'attributs' => 'a:6:{i:0;a:8:{s:8:"type_doc";a:26:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:5:"am;na";s:8:"zone_995";s:6:"LIV;MS";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:3:"PER";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:3:"i;j";s:8:"zone_995";s:17:"CD;LIVCD;LIVK7;K7";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:3:"DVD";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:3:"l;m";s:8:"zone_995";s:3:"CDR";}i:6;a:3:{s:4:"code";s:1:"6";s:5:"label";s:2:"cm";s:8:"zone_995";s:3:"PAR";}i:7;a:3:{s:4:"code";s:1:"7";s:5:"label";s:0:"";s:8:"zone_995";s:3:"BRO";}i:8;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DOS";}i:9;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:6:"WEB;MF";}i:11;a:3:{s:4:"code";s:2:"11";s:5:"label";s:0:"";s:8:"zone_995";s:3:"MET";}i:12;a:3:{s:4:"code";s:2:"12";s:5:"label";s:0:"";s:8:"zone_995";s:3:"JEU";}i:13;a:3:{s:4:"code";s:2:"13";s:5:"label";s:0:"";s:8:"zone_995";s:3:"CAR";}i:14;a:3:{s:4:"code";s:2:"14";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DDD";}i:15;a:3:{s:4:"code";s:2:"15";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DIA";}i:16;a:3:{s:4:"code";s:2:"16";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DIS";}i:17;a:3:{s:4:"code";s:2:"17";s:5:"label";s:0:"";s:8:"zone_995";s:3:"CDJ";}i:18;a:3:{s:4:"code";s:2:"18";s:5:"label";s:0:"";s:8:"zone_995";s:4:"LDVD";}i:19;a:3:{s:4:"code";s:2:"19";s:5:"label";s:0:"";s:8:"zone_995";s:3:"LIA";}i:20;a:3:{s:4:"code";s:2:"20";s:5:"label";s:0:"";s:8:"zone_995";s:3:"LIS";}i:21;a:3:{s:4:"code";s:2:"21";s:5:"label";s:0:"";s:8:"zone_995";s:3:"TXT";}i:22;a:3:{s:4:"code";s:2:"22";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:23;a:3:{s:4:"code";s:2:"23";s:5:"label";s:0:"";s:8:"zone_995";s:14:"VDD;VID;UMATIC";}i:24;a:3:{s:4:"code";s:2:"24";s:5:"label";s:0:"";s:8:"zone_995";s:4:"METI";}i:25;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"f";s:10:"champ_cote";s:1:"k";s:14:"champ_type_doc";s:0:"";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"q";s:17:"champ_emplacement";s:1:"l";s:12:"champ_annexe";s:1:"b";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"995";s:5:"champ";s:1:"v";s:6:"format";s:1:"3";s:5:"jours";s:0:"";s:7:"valeurs";s:1:"n";}}' - ]; + public function getProfilDonnees() { + return Class_IntProfilDonnees::forAloes()->setIdProfil(111) + ->getRawAttributes(); + } public function setUp() { parent::setUp(); @@ -629,16 +621,10 @@ class NoticeIntegrationBienveillantesTest extends NoticeIntegrationTestCase { class NoticeIntegrationZanzibarTest extends NoticeIntegrationTestCase { - protected $_profil_donnees = - ['id_profil' => 111, - 'libelle' => 'UNIMARC ALOES', - 'accents' => '1', - 'rejet_periodiques' => '0', - 'id_article_periodique' => '2', - 'type_fichier' => '0', - 'format' => '0', - 'attributs' => 'a:6:{i:0;a:8:{s:8:"type_doc";a:26:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:5:"am;na";s:8:"zone_995";s:6:"LIV;MS";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:3:"PER";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:3:"i;j";s:8:"zone_995";s:17:"CD;LIVCD;LIV7;K7";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:3:"DVD";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:3:"l;m";s:8:"zone_995";s:3:"CDR";}i:6;a:3:{s:4:"code";s:1:"6";s:5:"label";s:2:"cm";s:8:"zone_995";s:3:"PAR";}i:7;a:3:{s:4:"code";s:1:"7";s:5:"label";s:0:"";s:8:"zone_995";s:3:"BRO";}i:8;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DOS";}i:9;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:6:"WEB;MF";}i:11;a:3:{s:4:"code";s:2:"11";s:5:"label";s:0:"";s:8:"zone_995";s:3:"MET";}i:12;a:3:{s:4:"code";s:2:"12";s:5:"label";s:0:"";s:8:"zone_995";s:3:"JEU";}i:13;a:3:{s:4:"code";s:2:"13";s:5:"label";s:0:"";s:8:"zone_995";s:3:"CAR";}i:14;a:3:{s:4:"code";s:2:"14";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DDD";}i:15;a:3:{s:4:"code";s:2:"15";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DIA";}i:16;a:3:{s:4:"code";s:2:"16";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DIS";}i:17;a:3:{s:4:"code";s:2:"17";s:5:"label";s:0:"";s:8:"zone_995";s:3:"CDJ";}i:18;a:3:{s:4:"code";s:2:"18";s:5:"label";s:0:"";s:8:"zone_995";s:4:"LDVD";}i:19;a:3:{s:4:"code";s:2:"19";s:5:"label";s:0:"";s:8:"zone_995";s:3:"LIA";}i:20;a:3:{s:4:"code";s:2:"20";s:5:"label";s:0:"";s:8:"zone_995";s:3:"LIS";}i:21;a:3:{s:4:"code";s:2:"21";s:5:"label";s:0:"";s:8:"zone_995";s:3:"TXT";}i:22;a:3:{s:4:"code";s:2:"22";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:23;a:3:{s:4:"code";s:2:"23";s:5:"label";s:0:"";s:8:"zone_995";s:14:"VDD;VID;UMATIC";}i:24;a:3:{s:4:"code";s:2:"24";s:5:"label";s:0:"";s:8:"zone_995";s:4:"METI";}i:25;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"f";s:10:"champ_cote";s:1:"k";s:14:"champ_type_doc";s:0:"";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"q";s:17:"champ_emplacement";s:1:"u";s:12:"champ_annexe";s:1:"b";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:11:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:9:"NUM_CARTE";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"995";s:5:"champ";s:1:"v";s:6:"format";s:1:"3";s:5:"jours";s:0:"";s:7:"valeurs";s:1:"n";}}' - ]; + public function getProfilDonnees() { + return Class_IntProfilDonnees::forAloes()->setIdProfil(111) + ->getRawAttributes(); + } public function setUp() { parent::setUp(); @@ -715,16 +701,17 @@ class NoticeIntegrationCekovTest extends NoticeIntegrationTestCase { public function noticeFirstItemShouldHaveZone995AsSerializedArray() { $this->assertEquals( serialize([['code' => 'a', 'valeur' => 'Béalières'], - ['code' => 'f', 'valeur' => '0002'], - ['code' => 'k', 'valeur' => '915.770 ČEH'], - ['code' => 'm', 'valeur' => '20131106'], - ['code' => 'q', 'valeur' => 'a'], - ['code' => 'r', 'valeur' => 'aa'], - ['code' => 'o', 'valeur' => 'c'], - ['code' => '2', 'valeur' => '[DISP][Disponible][0][1][En rayon][0][0][0][0]'], - ['code' => '4', 'valeur' => '2014-02-04'], - ['code' => '8', 'valeur' => '2'], - ['code' => '9', 'valeur' => '2']]), + ['code' => 'f', 'valeur' => '0002'], + ['code' => 'k', 'valeur' => '915.770 ČEH'], + ['code' => 'm', 'valeur' => '20131106'], + ['code' => 'q', 'valeur' => 'a'], + ['code' => 'r', 'valeur' => 'aa'], + ['code' => 'o', 'valeur' => 'c'], + ['code' => '2', 'valeur' => '[DISP][Disponible][0][1][En rayon][0][0][0][0]'], + ['code' => '4', 'valeur' => '2014-02-04'], + ['code' => '8', 'valeur' => '2'], + ['code' => '9', 'valeur' => '2']]), + $this->notice_data['exemplaires'][0]['zone995']); } @@ -738,7 +725,7 @@ class NoticeIntegrationCekovTest extends NoticeIntegrationTestCase { /** @test */ public function firstItemActivityShouldBeAConsulterSurPlace() { $this->assertEquals('En rayon', - $this->notice_data['exemplaires'][0]['activite']); + $this->notice_data['exemplaires'][0]['activite']); } } @@ -766,51 +753,51 @@ class NoticeIntegrationBearsBeerMicrobibTest extends NoticeIntegrationTestCase { public function getProfilDonnees() { return ['id_profil' => 106, - 'libelle' => 'Microbib', - 'accents' => '1', - 'rejet_periodiques' => '1', - 'id_article_periodique' => '2', - 'type_fichier' => '0', - 'format' => '0', - 'attributs' => serialize( - [ [ - 'type_doc' => [ - [ 'code' => '0', 'label' => '', 'zone_995' => '' ], - [ 'code' => '1', 'label' => 'am;as', 'zone_995' => 'az' ], - [ 'code' => '2', 'label' => '', 'zone_995' => ''], - [ 'code' => '3', 'label' => 'i;j;k', 'zone_995' => ''], - [ 'code' => '4', 'label' => 'g','zone_995' => ''], - [ 'code' => '5', 'label' => 'l;m', 'zone_995' => ''], - [ 'code' => '8', 'label' => '', 'zone_995' => ''], - [ 'code' => '9', 'label' => '', 'zone_995' => '' ], - [ 'code' => '10', 'label' => '', 'zone_995' => ''], - [ 'code' => '9', 'label' => '', 'zone_995' => ''], - [ 'code' => '10', 'label' => '', 'zone_995' => ''] - ], - 'champ_code_barres' => 'f', - 'champ_cote' => 'k', - 'champ_type_doc' => '', - 'champ_genre' => 'e', - 'champ_section' => 'q', - 'champ_emplacement' => 'u', - 'champ_annexe' => '' - ], - - [ 'champs' => ''], - [ 'champs' => ''], - [ 'champs' => ''], - [ 'champs' => '', 'xml_balise_abonne' => '', 'xml_champs_abonne' => [ 'IDABON' => '', - 'ORDREABON' => '', - 'NOM' => '', - 'PRENOM' => '', - 'NAISSANCE' => '', - 'PASSWORD' => '', - 'MAIL' => '', - 'DATE_DEBUT' => '', - 'DATE_FIN' => '', - 'ID_SIGB' => '' ] ], - [ 'zone' => '995', 'champ' => 's', 'format' => '3', 'jours' => '', 'valeurs' => 'nouveaute'] - ])]; + 'libelle' => 'Microbib', + 'accents' => '1', + 'rejet_periodiques' => '1', + 'id_article_periodique' => '2', + 'type_fichier' => '0', + 'format' => '0', + 'attributs' => serialize( + [ [ + 'type_doc' => [ + [ 'code' => '0', 'label' => '', 'zone_995' => '' ], + [ 'code' => '1', 'label' => 'am;as', 'zone_995' => 'az' ], + [ 'code' => '2', 'label' => '', 'zone_995' => ''], + [ 'code' => '3', 'label' => 'i;j;k', 'zone_995' => ''], + [ 'code' => '4', 'label' => 'g','zone_995' => ''], + [ 'code' => '5', 'label' => 'l;m', 'zone_995' => ''], + [ 'code' => '8', 'label' => '', 'zone_995' => ''], + [ 'code' => '9', 'label' => '', 'zone_995' => '' ], + [ 'code' => '10', 'label' => '', 'zone_995' => ''], + [ 'code' => '9', 'label' => '', 'zone_995' => ''], + [ 'code' => '10', 'label' => '', 'zone_995' => ''] + ], + 'champ_code_barres' => 'f', + 'champ_cote' => 'k', + 'champ_type_doc' => '', + 'champ_genre' => 'e', + 'champ_section' => 'q', + 'champ_emplacement' => 'u', + 'champ_annexe' => '' + ], + + [ 'champs' => ''], + [ 'champs' => ''], + [ 'champs' => ''], + [ 'champs' => '', 'xml_balise_abonne' => '', 'xml_champs_abonne' => [ 'IDABON' => '', + 'ORDREABON' => '', + 'NOM' => '', + 'PRENOM' => '', + 'NAISSANCE' => '', + 'PASSWORD' => '', + 'MAIL' => '', + 'DATE_DEBUT' => '', + 'DATE_FIN' => '', + 'ID_SIGB' => '' ] ], + [ 'zone' => '995', 'champ' => 's', 'format' => '3', 'jours' => '', 'valeurs' => 'nouveaute'] + ])]; } @@ -837,7 +824,7 @@ class NoticeIntegrationBearsBeerMicrobibTest extends NoticeIntegrationTestCase { /** @test */ public function titleShouldBeBears() { $this->assertEquals('Bears + beer : formule n°1', - $this->notice_integration->get_subfield('200', 'a')[0]); + $this->notice_integration->get_subfield('200', 'a')[0]); } } @@ -873,10 +860,15 @@ class NoticeIntegrationDimancheALaPiscineTest extends NoticeIntegrationTestCase ->whenCalled('fetchAll') ->with('select * from codif_genre', false) ->answers([ - ['id_genre' => 8, - 'regles' => '902$a=Roman']]) - ; + ['id_genre' => 8, + 'regles' => '902$a=Roman']]); + + $this->fixture('Class_CodifAnnexe', [ + 'code' => 'A', + 'libelle' => 'Antibes', + 'id_bib' => 4]); + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Exemplaire'); $this->loadNotice("unimarc_dimanche_a_la_piscine"); } @@ -904,7 +896,7 @@ class NoticeIntegrationDimancheALaPiscineTest extends NoticeIntegrationTestCase $this->assertTrue( $this->_mock_sql ->methodHasBeenCalledWithParams('fetchOne', - ['select libelle from codif_genre where id_genre=8'])); + ['select libelle from codif_genre where id_genre=8'])); } @@ -919,10 +911,94 @@ class NoticeIntegrationDimancheALaPiscineTest extends NoticeIntegrationTestCase * @see #13453 */ public function uniciteCodeBarreShouldNotRegress() { - $this->assertTrue( - $this->_mock_sql - ->methodHasBeenCalledWithParams('execute', - ['delete from exemplaires where id_notice=12 and id_bib=1 and code_barres in (\'2060303\')'])); + $this->assertEquals( + [ + 'id_notice' => 1, + 'id_int_bib' => 1, + 'code_barres' => [2060303] + ], + Class_Exemplaire::getLoader()->getFirstAttributeForLastCallOn('deleteBy') + ); + } + + + /** @test */ + public function exemplaireShouldHaveBeenSavedForNotice1() { + $exemplaire = Class_Exemplaire::findFirstBy(['id_notice' => 1]); + $this->assertNotEmpty($exemplaire); + return $exemplaire; + } + + + /** + * @test + * @depends exemplaireShouldHaveBeenSavedForNotice1 + */ + public function exemplaireIdOrigineShouldBe0419704($exemplaire) { + $this->assertEquals('0419704', $exemplaire->getIdOrigine()); + } + + + /** + * @test + * @depends exemplaireShouldHaveBeenSavedForNotice1 + */ + public function exemplaireAnnexeShouldBeAntibes($exemplaire) { + $this->assertEquals('A', $exemplaire->getAnnexe()); + } + + + /** + * @test + * @depends exemplaireShouldHaveBeenSavedForNotice1 + */ + public function exemplaireIdBibShouldBeFour($exemplaire) { + $this->assertEquals(4, $exemplaire->getIdBib()); + } + + + /** + * @test + * @depends exemplaireShouldHaveBeenSavedForNotice1 + */ + public function exemplaireIdIntBibShouldBeOne($exemplaire) { + $this->assertEquals(1, $exemplaire->getIdIntBib()); + } + + + /** @test */ + public function noticeOneDateMajShouldBeToday() { + $this->assertContains(date('Y-m-d'), Class_Notice::find(1)->getDateMaj()); + } + + + /** @test */ + public function supprimerExemplaireShouldRemoveIt() { + $this->notice_integration->supprimerExemplaire(1, ['code_barres' => '2060303']); + Class_Exemplaire::clearCache(); + $this->assertEmpty(Class_Exemplaire::findFirstBy(['id_notice' => 1])); + } + + + /** @test */ + public function supprimerExemplaireWithUnknownCodeBarresShouldSetError() { + $this->notice_integration->supprimerExemplaire(1, ['code_barres' => '666']); + $this->assertEquals(['statut' => 0, + 'erreur' => 'code-barres à supprimer non trouvé', + 'warnings' => [], + 'identification' => 'non trouvée'], + $this->notice_integration->getLastStatut()); + } + + + /** @test */ + public function supprimerExemplaireWithNoIdNoticeShouldSetError() { + $this->notice_integration->supprimerExemplaire(0, []); + $this->assertEquals(['statut' => 0, + 'erreur' => 'notice de l\'exemplaire à supprimer non trouvée', + 'warnings' => [], + 'identification' => 'non trouvée'], + $this->notice_integration->getLastStatut()); } } @@ -1011,11 +1087,11 @@ class NoticeIntegrationItemsIn852Test extends NoticeIntegrationTestCase { ->whenCalled('fetchAll') ->with('select * from codif_section', false) ->answers([ - ['id_section' => 2, - 'regles' => '852$q=AVJE'], - ['id_section' => 3, - 'invisible' => 1, - 'regles' => '852$q=MOJE']]) + ['id_section' => 2, + 'regles' => '852$q=AVJE'], + ['id_section' => 3, + 'invisible' => 1, + 'regles' => '852$q=MOJE']]) ->whenCalled('fetchEnreg') ->with('select * from codif_section where id_section=3', false) @@ -1057,21 +1133,68 @@ class NoticeIntegrationItemsIn852Test extends NoticeIntegrationTestCase { } -class NoticeIntegrationKohaPeriodiqueTest extends NoticeIntegrationTestCase { + + +class NoticeIntegrationKohaBadUnimarcTest extends NoticeIntegrationTestCase { + public function getProfilDonnees() { + return Class_IntProfilDonnees::forKoha()->getRawAttributes(); + } + + + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_bad_pagaille'); + } + + + /** @test */ + public function titleShouldBePagaille() { + $this->assertEquals('La Pagaille', $this->notice_data['titres'][0]); + } +} + + + + + +class NoticeIntegrationKohaPeriodiqueNotIdentifiedTest extends NoticeIntegrationTestCase { protected $_profil_donnees = [ 'id_profil' => 113, 'libelle' => 'Unimarc Koha', 'accents' => 0, - 'rejet_periodiques' => 0, + 'rejet_periodiques' => 0, 'id_article_periodique' => 3, 'type_fichier' => 0, 'format' => 0, 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:25:{i:0;a:3:{s:4:"code";s:1:"0";s:5:"label";s:0:"";s:8:"zone_995";s:3:"IND";}i:1;a:3:{s:4:"code";s:1:"1";s:5:"label";s:5:"am;na";s:8:"zone_995";s:39:"LIV;JLIV;JLCD;LCD;PAR;JPAR;CAR;IMA;JIMA";}i:2;a:3:{s:4:"code";s:1:"2";s:5:"label";s:2:"as";s:8:"zone_995";s:18:"REV;JREV:REVA;REVJ";}i:3;a:3:{s:4:"code";s:1:"3";s:5:"label";s:3:"i;j";s:8:"zone_995";s:25:"CDI;JCDI;LCA;CDI;JCDI;LCA";}i:4;a:3:{s:4:"code";s:1:"4";s:5:"label";s:1:"g";s:8:"zone_995";s:22:"DVD;JDVD;DVDA;DVDJ;VID";}i:5;a:3:{s:4:"code";s:1:"5";s:5:"label";s:3:"l;m";s:8:"zone_995";s:9:"CDROM;CDR";}i:6;a:3:{s:4:"code";s:1:"6";s:5:"label";s:0:"";s:8:"zone_995";s:3:"LCD";}i:7;a:3:{s:4:"code";s:1:"7";s:5:"label";s:0:"";s:8:"zone_995";s:3:"PAR";}i:8;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:10;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:11;a:3:{s:4:"code";s:2:"11";s:5:"label";s:0:"";s:8:"zone_995";s:4:"JVID";}i:12;a:3:{s:4:"code";s:2:"12";s:5:"label";s:0:"";s:8:"zone_995";s:3:"MAT";}i:13;a:3:{s:4:"code";s:2:"13";s:5:"label";s:2:"km";s:8:"zone_995";s:3:"EST";}i:14;a:3:{s:4:"code";s:3:"100";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:15;a:3:{s:4:"code";s:3:"101";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:16;a:3:{s:4:"code";s:3:"102";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:17;a:3:{s:4:"code";s:3:"103";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:18;a:3:{s:4:"code";s:3:"104";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:19;a:3:{s:4:"code";s:3:"105";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:20;a:3:{s:4:"code";s:3:"106";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:21;a:3:{s:4:"code";s:3:"107";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:22;a:3:{s:4:"code";s:3:"108";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:23;a:3:{s:4:"code";s:3:"109";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:24;a:3:{s:4:"code";s:3:"110";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}}s:17:"champ_code_barres";s:1:"f";s:10:"champ_cote";s:1:"k";s:14:"champ_type_doc";s:1:"r";s:11:"champ_genre";s:0:"";s:13:"champ_section";s:1:"q";s:17:"champ_emplacement";s:1:"e";s:12:"champ_annexe";s:1:"b";}i:1;a:1:{s:6:"champs";s:0:"";}i:2;a:1:{s:6:"champs";s:0:"";}i:3;a:1:{s:6:"champs";s:0:"";}i:5;a:3:{s:6:"champs";s:0:"";s:17:"xml_balise_abonne";s:0:"";s:17:"xml_champs_abonne";a:22:{s:6:"IDABON";s:0:"";s:9:"ORDREABON";s:0:"";s:3:"NOM";s:0:"";s:6:"PRENOM";s:0:"";s:9:"NAISSANCE";s:0:"";s:8:"PASSWORD";s:0:"";s:4:"MAIL";s:0:"";s:10:"DATE_DEBUT";s:0:"";s:8:"DATE_FIN";s:0:"";s:7:"ID_SIGB";s:0:"";s:7:"_IDABON";s:0:"";s:10:"_ORDREABON";s:0:"";s:4:"_NOM";s:0:"";s:7:"_PRENOM";s:0:"";s:10:"_NAISSANCE";s:0:"";s:9:"_PASSWORD";s:0:"";s:5:"_MAIL";s:0:"";s:11:"_DATE_DEBUT";s:0:"";s:9:"_DATE_FIN";s:0:"";s:8:"_ID_SIGB";s:0:"";s:10:"_NUM_CARTE";s:0:"";s:5:"_NULL";s:0:"";}}i:4;a:5:{s:4:"zone";s:3:"801";s:5:"champ";s:1:"c";s:6:"format";s:1:"2";s:5:"jours";s:2:"90";s:7:"valeurs";s:0:"";}i:6;a:2:{s:4:"zone";s:3:"901";s:5:"champ";s:1:"a";}}' - ]; + ]; + public function setUp() { + parent::setUp(); + $this->loadNotice('unimarc_no_bloc_label_koha'); + } + + + /** @test */ + public function typeDocShouldBeZero() { + $this->assertSame(0, + $this->notice_integration->noticeToDBEnreg($this->notice_data)['type_doc']); + } + +} + + + + +class NoticeIntegrationKohaPeriodiqueTest extends NoticeIntegrationTestCase { protected $_record_inserts; protected $_item_inserts; + public function getProfilDonnees() { + return Class_IntProfilDonnees::forKoha()->setIdProfil(113) + ->getRawAttributes(); + } + public function setUp() { parent::setUp(); $this->_mock_sql @@ -1088,8 +1211,8 @@ class NoticeIntegrationKohaPeriodiqueTest extends NoticeIntegrationTestCase { ->whenCalled('fetchAll') ->with('select * from codif_emplacement', false) ->answers([ - ['id_emplacement' => 3, - '995$e=A']]) + ['id_emplacement' => 3, + '995$e=A']]) ->whenCalled('fetchEnreg') ->with('select * from int_bib where id_bib=1') @@ -1124,53 +1247,47 @@ class NoticeIntegrationKohaPeriodiqueTest extends NoticeIntegrationTestCase { ->answers(['code' => 'BLV']); $this->loadNotice('unimarc_kohaperiodique'); + } - $this->_record_inserts = []; - foreach (range(0, $this->_mock_sql->methodCallCount('insert')) as $index) { - $params = $this->_mock_sql->getAttributesForMethodCallAt('insert', $index); - if ($params[0] == 'notices') - $this->_record_inserts[] = $params[1]; - } - $this->_item_inserts = []; - foreach (range(0, $this->_mock_sql->methodCallCount('insert')) as $index) { - $params = $this->_mock_sql->getAttributesForMethodCallAt('insert', $index); - if ($params[0] == 'exemplaires') - $this->_item_inserts[] = $params[1]; - } + /** @test */ + public function shouldHaveInserted51Records() { + $this->assertEquals(51, count(Class_Notice::findAll())); } /** @test */ - public function shouldHaveInsertedRecordFor51Items() { - $this->assertEquals(51, count($this->_record_inserts)); + public function typeDocShouldBeTwo() { + $this->assertEquals(2, + $this->notice_integration->noticeToDBEnreg($this->notice_data)['type_doc']); } /** @test */ public function shouldHaveInserted51Items() { - $this->assertEquals(51, count($this->_item_inserts)); + $this->assertEquals(51, count(Class_Exemplaire::findAll())); } /** @test */ public function recordsTitleShouldBeOriginTitle() { - foreach ($this->recordTitles() as $title) - $this->assertContains('MARIE CLAIRE', $title); + foreach (Class_Notice::findAll() as $notice) + $this->assertContains('MARIE CLAIRE', $notice->getTitrePrincipal()); } /** @test */ public function firstTitleShouldContainsNumber725() { - $this->assertEquals('MARIE CLAIRE 725', - $this->_record_inserts[0]['alpha_titre']); + $this->assertEquals( + 'MARIE CLAIRE 725 JANVIER 2013', + Class_Notice::findFirstBy([])->getAlphaTitre()); } /** @test */ public function firstNumberShouldBe725() { $this->assertEquals( - '725', + '725 Janvier 2013', $this->getSubfieldAt('461', 'v', 1, $this->marcDumpFor($this->unimarcAt(0)))); } @@ -1185,7 +1302,7 @@ class NoticeIntegrationKohaPeriodiqueTest extends NoticeIntegrationTestCase { /** @test */ public function firstItemBarcodeShouldBe62432666() { - $this->assertEquals('62432666', $this->_item_inserts[0]['code_barres']); + $this->assertEquals('62432666', Class_Exemplaire::findFirstBy([])->getCodeBarres()); } @@ -1197,7 +1314,8 @@ class NoticeIntegrationKohaPeriodiqueTest extends NoticeIntegrationTestCase { protected function unimarcAt($index) { - return $this->_record_inserts[$index]['unimarc']; + $notice = Class_Notice::findAll()[$index]; + return $notice->getUnimarc(); } @@ -1263,6 +1381,13 @@ class NoticeIntegrationBiblioArcheoAnimauxTest extends NoticeIntegrationTestCase } + /** @test */ + public function typeDocShouldBeOne() { + $this->assertEquals(1, + $this->notice_integration->noticeToDBEnreg($this->notice_data)['type_doc']); + } + + /** @test */ public function field200AShouldBeAsExpected() { $this->assertEquals('Archéo animaux',$this->notice_sgbd->get_subfield('200', 'a')[0]); @@ -1367,51 +1492,43 @@ class NoticeIntegrationPergameEmplacementZeroTest extends NoticeIntegrationTestC ['id_emplacement' => 3, 'regles' => '995$6=0']]); $this->loadNotice('unimarc_emplacement_codif_zero'); - - $this->_item_inserts = []; - foreach (range(0, $this->_mock_sql->methodCallCount('insert')) as $index) { - $params = $this->_mock_sql->getAttributesForMethodCallAt('insert', $index); - if ($params[0] == 'exemplaires') - $this->_item_inserts[] = $params[1]; - } - - $this->firstItem = $this->_item_inserts[0]; + $this->exemplaire = Class_Exemplaire::findFirstBy([]); } /** @test */ public function shouldHaveOneItem() { - $this->assertEquals(1, count($this->_item_inserts)); + $this->assertEquals(1, count(Class_Exemplaire::findAll())); } /** @test */ - public function itemEmplacementShouldBeThree() { - $this->assertEquals(3, $this->firstItem['emplacement']); + public function exemplaireEmplacementShouldBeThree() { + $this->assertEquals(3, $this->exemplaire->getEmplacement()); } /** @test */ - public function itemBarcodeShouldBeL01528() { - $this->assertEquals('L-01528', $this->firstItem['code_barres']); + public function exemplaireBarcodeShouldBeL01528() { + $this->assertEquals('L-01528', $this->exemplaire->getCodeBarres()); } /** @test */ - public function itemCodeShouldBeOk() { - $this->assertEquals('R BOI B', $this->firstItem['cote']); + public function exemplaireCodeShouldBeOk() { + $this->assertEquals('R BOI B', $this->exemplaire->getCote()); } /** @test */ - public function itemSectionShouldBeOne() { - $this->assertEquals(1, $this->firstItem['section']); + public function exemplaireSectionShouldBeOne() { + $this->assertEquals(1, $this->exemplaire->getSection()); } /** @test */ - public function itemZone995ShouldContaineDollarSixEqualsZero() { - foreach(unserialize($this->firstItem['zone995']) as $field) { + public function exemplaireZone995ShouldContaineDollarSixEqualsZero() { + foreach(unserialize($this->exemplaire->getZone995()) as $field) { if ('6' == $field['code']) { $this->assertEquals('0', $field['valeur']); return; @@ -1423,6 +1540,7 @@ class NoticeIntegrationPergameEmplacementZeroTest extends NoticeIntegrationTestC + class NoticeIntegrationDossier64Test extends NoticeIntegrationTestCase { protected $_profil_donnees = [ 'id_profil' => 100, @@ -1460,6 +1578,8 @@ class NoticeIntegrationDossier64Test extends NoticeIntegrationTestCase { } + + class NoticeIntegrationGenreMultiple902Test extends NoticeIntegrationTestCase { public function setUp() { parent::setUp(); diff --git a/cosmogramme/tests/php/classes/unimarc_bad_pagaille.txt b/cosmogramme/tests/php/classes/unimarc_bad_pagaille.txt new file mode 100644 index 0000000000000000000000000000000000000000..c172f18042c88eefc2338f9418d0e47d993b92b1 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_bad_pagaille.txt @@ -0,0 +1 @@ +03400 2200229 45000010006000000100014000060710037000200730018000570900009000750910019000840990016001031000041001191010008001602000148001682100038003162150026003543000066003803300492004466100013009387000029009519702190009801258 d34.07 Eur bL.c.j. Editions Productionsa820 a3550460034185 a1258 a2b20140822c0 eVERLAYtDVD a20120910 frey50 afre aLa Pagaille fPascal Thomas, réal. et scén.gAgenore Incrocci, scén.gFrançois Périer, Patrick Chesnais, Remy Girard, Coralie Seyrig, act. cL.c.j. Editions Productionsd1991 a1 DVD (100 mn)ccoul. aPrêt + Consultation sur place coll. et Projection collective aMartin, séparé de sa femme Brigitte depuis 7 ans, vit avec Clément et Emilie ses deux enfants d'une vingtaine d'années, et Gabriel son beau père. Il a une relation régulière avec une jeune femme Patricia. Martin retrouve par hasard Brigitte et ils revivent un second grand amour, au grand dam de leurs proches, qui étaient tout à fait satisfaits de ce mode de vie "moderne". Pour échapper à ceux qui veulent les séparer, les époux préfèrent quitter le domicile familial... aComédie aThomasbPascal43704690 3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m3http://catalogue.bnf.fr/ark:/12148/cb16745882m9746643http://catalogue.bnf.fr/ark:/12148/cb16745882maIncroccibAgenoref1919-20054690 13146571743http://ca 13139308153http://catalogue.bnf.f 1aPérier bFrançois4005 0aFRbCVSc20120822 fSTJ006212i34.07w2014-03-05300094077cMTRSTJ20kCo THO52012-12-07o0ecinema adultesddcrDVDm2014-02 diff --git a/cosmogramme/tests/php/classes/unimarc_no_bloc_label_koha.txt b/cosmogramme/tests/php/classes/unimarc_no_bloc_label_koha.txt new file mode 100644 index 0000000000000000000000000000000000000000..e09ea452c53133163efa74a16969d9e5f6f8fd4d --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_no_bloc_label_koha.txt @@ -0,0 +1 @@ +00498 0a2200157 450 00100060000001100140000609000100002009900060003010000410003610100080007720000840008521000200016946100260018946100200021599501050023560282 a1256-7809 a60282 z1 a19961210a1994 k y0frey50 ba afre1 aArkéo Junior (Dijon)fDirectrice de la publication : Pierrette Fabre-FatonbPG cEd. Fatond199611tArkéo Junior (Dijon)11vN168 01/10/2009 f38201002649432m2010-11-109182300cPAT20k4°P412vN168 01/10/2009o0eperiodiqueshCSPs6bMEDt1 diff --git a/library/Class/Bib.php b/library/Class/Bib.php index b71dbfeafd467b9ac72048ff0cefe0dc545549f2..7b8473757b2aa6edb9759772b6820a38216cf8e0 100644 --- a/library/Class/Bib.php +++ b/library/Class/Bib.php @@ -575,10 +575,5 @@ class Class_Bib extends Storm_Model_Abstract { public function getArticleCategoriesToJson() { return $this->articlesToJSON(false); } - - - public function getSigbExemplaire($id_origine, $code_barres) { - return Class_IntBib::find($this->getId())->getSigbExemplaire($id_origine, $code_barres); - } } ?> \ No newline at end of file diff --git a/library/Class/CommSigb.php b/library/Class/CommSigb.php index 05c9f1c5794dd84cf01c0d2082df6cecd93d2633..496aaa1a97ae5ce8555bc26a21190061d6ae5018 100644 --- a/library/Class/CommSigb.php +++ b/library/Class/CommSigb.php @@ -39,7 +39,7 @@ class Class_CommSigb { public function getDispoExemplaires($exemplaires_to_check) { $exemplaires = array(); foreach ($exemplaires_to_check as $exemplaire) { - if ($dispo = $this->getDispoExemplaire($exemplaire["id_bib"], + if ($dispo = $this->getDispoExemplaire($exemplaire["id_int_bib"], $exemplaire["id_origine"], $exemplaire["code_barres"])) $exemplaires []= array_merge($exemplaire, $dispo); @@ -83,8 +83,8 @@ class Class_CommSigb { //pour la localisation de l'exemplaire en temps reel $exemplaire["annexe"] = $code_annexe; - if (is_numeric($code_annexe)) - $exemplaire["id_bib"] = $code_annexe; + if ($annexe = Class_CodifAnnexe::findFirstBy(['code' => $code_annexe])) + $exemplaire["id_bib"] = $annexe->getIdBib(); return $exemplaire; } diff --git a/library/Class/Exemplaire.php b/library/Class/Exemplaire.php index 06256ae94d1166bbe10b932b3f304ef501a0e6ec..92a0922d869aafc6de077ee8202e6e819ea24aae 100644 --- a/library/Class/Exemplaire.php +++ b/library/Class/Exemplaire.php @@ -33,10 +33,13 @@ class Class_Exemplaire extends Storm_Model_Abstract { 'album' => ['model' => 'Class_Album', 'referenced_in' => 'id_origine'], - 'int_bib' => ['through' => 'bib']]; + 'int_bib' => [ 'model' => 'Class_IntBib', + 'referenced_in' => 'id_int_bib']]; - protected $_default_attribute_values = ['id_origine' => null, - 'code_barres' => null]; + protected $_default_attribute_values = [ + 'id_origine' => null, + 'code_barres' => null, + 'annexe' => null]; protected $_sigb_exemplaire; @@ -86,8 +89,10 @@ class Class_Exemplaire extends Storm_Model_Abstract { public function getSigbExemplaire() { if (!isset($this->_sigb_exemplaire)) - $this->_sigb_exemplaire = $this->getBib()->getSigbExemplaire($this->getIdOrigine(), - $this->getCodeBarres()); + $this->_sigb_exemplaire = $this->getIntBib() + ->getSigbExemplaire( + $this->getIdOrigine(), + $this->getCodeBarres()); return $this->_sigb_exemplaire; } diff --git a/library/Class/IntBib.php b/library/Class/IntBib.php index 1b115571534f416957b064f3c07277e7f1cc7082..d014568efaab7610152c4c000f4ffa3a84d56a03 100644 --- a/library/Class/IntBib.php +++ b/library/Class/IntBib.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 */ /** @@ -35,7 +35,7 @@ class Class_IntBib extends Storm_Model_Abstract { const COM_MICROBIB = 9; const COM_BIBLIXNET = 10; const COM_DYNIX = 11; - + @@ -53,10 +53,13 @@ class Class_IntBib extends Storm_Model_Abstract { protected $_table_name = 'int_bib'; protected $_table_primary = 'id_bib'; - protected $_belongs_to = ['bib' => ['model' => 'Class_IntBib', + protected $_belongs_to = ['bib' => ['model' => 'Class_Bib', 'role' => 'int_bib', 'referenced_in' => 'id_bib']]; + protected $_has_many = ['int_maj_autos' => ['model' => 'Class_IntMajAuto', + 'role' => 'int_bib']]; + protected $_default_attribute_values = ['comm_params' => '']; @@ -70,6 +73,13 @@ class Class_IntBib extends Storm_Model_Abstract { } + public function getLabel() { + if ($bib = $this->getBib()) + return $bib->getLibelle(); + return $this->getNomCourt(); + } + + public function setCommParams($string_or_array) { if (is_array($string_or_array)) $cfg = serialize($string_or_array); @@ -99,7 +109,7 @@ class Class_IntBib extends Storm_Model_Abstract { if (!isset(self::$COM_CLASSES[$type_comm])) return null; - $comm = call_user_func([self::$COM_CLASSES[$type_comm], 'getService'], + $comm = call_user_func([self::$COM_CLASSES[$type_comm], 'getService'], $this->getModeComm()); return $comm; } diff --git a/library/Class/IntMajAuto.php b/library/Class/IntMajAuto.php index 2b6da0f462e664ca9af7a8d0bb6d0d6dae79c2d4..b7a52f6c5a451eb3d6715d0f7000d99f88c460a0 100644 --- a/library/Class/IntMajAuto.php +++ b/library/Class/IntMajAuto.php @@ -16,12 +16,20 @@ * * 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_IntMajAuto extends Storm_Model_Abstract { + const OP_PARTIAL_IMPORT = 0; + const OP_ITEMS_DELETION = 1; + const OP_FULL_IMPORT = 2; + const OP_DELETE_PERGAME_HEADER = 3; + protected $_table_name = 'int_maj_auto'; protected $_table_primary = 'id_prog'; + + protected $_belongs_to = ['int_bib' => ['model' => 'Class_IntBib', + 'referenced_in' => 'id_bib']]; } ?> \ No newline at end of file diff --git a/library/Class/IntProfilDonnees.php b/library/Class/IntProfilDonnees.php new file mode 100644 index 0000000000000000000000000000000000000000..950b4fda88119701b1c20b011f5ec3e07fdb916b --- /dev/null +++ b/library/Class/IntProfilDonnees.php @@ -0,0 +1,152 @@ +<?php +/** + * Copyright (c) 2012, 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 + */ + +class Class_IntProfilDonnees extends Storm_Model_Abstract { + const + FT_RECORDS = 0, + FT_PATRONS = 1, + FT_HOLDS = 2, + ENCODING_UTF8 = 0, + ENCODING_ISO2709 = 1, + ENCODING_WINDOWS_ANSI = 2, + ENCODING_MARC21 = 4, + FORMAT_UNIMARC = 0, + FORMAT_TABBED_ASCII = 1, + FORMAT_SEMI_COLON_ASCII = 2, + FORMAT_PIPED_ASCII = 3, + FORMAT_XML = 4, + FORMAT_CSV = 5, + FORMAT_MARC21 = 6, + SERIAL_FORMAT_NONE = 0, + SERIAL_FORMAT_PERGAME = 1, + SERIAL_FORMAT_ALOES_INDEXPRESS = 2, + SERIAL_FORMAT_KOHA = 3, + SERIAL_FORMAT_ORPHEE = 4, + NOVELTY_DATE_FORMAT_NONE = 0, + NOVELTY_DATE_FORMAT_AAAA_MM_JJ = 1, + NOVELTY_DATE_FORMAT_AAAAMMJJ = 2, + NOVELTY_DATE_FORMAT_VALUES = 3, + NOVELTY_DATE_FORMAT_JJ_MM_AAAA = 4, + NOVELTY_DATE_FORMAT_SLASHED_JMAAAA = 5; + + protected $_table_name = 'profil_donnees'; + protected $_table_primary = 'id_profil'; + + + public static function forALOES() { + return self::newInstance( + ['libelle' => 'Unimarc Aloes', + 'accents' => self::ENCODING_ISO2709, + 'rejet_periodiques' => '1', + 'id_article_periodique' => self::SERIAL_FORMAT_ALOES_INDEXPRESS, + 'type_fichier' => self::FT_RECORDS, + 'format' => self::FORMAT_UNIMARC, + 'attributs' => [ + ['type_doc' => [ + [ 'code' => '0', 'label' => '', 'zone_995' => '' ], + [ 'code' => '1', 'label' => 'am;na', 'zone_995' => 'LIV;MS;az' ], + [ 'code' => '2', 'label' => 'as', 'zone_995' => 'PER;uu'], + [ 'code' => '3', 'label' => 'i;j', 'zone_995' => 'CD;LIVCD;LIVK7;K7'], + [ 'code' => '4', 'label' => 'g','zone_995' => 'DIAPO;DVD;VHS;VHD;VD;ge'], + [ 'code' => '5', 'label' => 'l;m', 'zone_995' => 'CDR;le'], + [ 'code' => '6', 'label' => '', 'zone_995' => 'LCD' ], + [ 'code' => '7', 'label' => '', 'zone_995' => 'CAR' ], + [ 'code' => '8', 'label' => '', 'zone_995' => 'PAD'], + [ 'code' => '9', 'label' => '', 'zone_995' => 'WEB;MF'], + [ 'code' => '10', 'label' => '', 'zone_995' => 'BRD'], + [ 'code' => '11', 'label' => '', 'zone_995' => 'PAR'] + ], + 'champ_code_barres' => 'f', + 'champ_cote' => 'k', + 'champ_type_doc' => '', + 'champ_genre' => '', + 'champ_section' => 'q', + 'champ_emplacement' => 'l', + 'champ_annexe' => 'b' + ], + ['zone' => '995', + 'champ' => 'v', + 'format' => self::NOVELTY_DATE_FORMAT_VALUES, + 'jours' => '', + 'valeurs' => 'nouveaute'] + ] + ] + ); + } + + + + public static function forKoha() { + return self::newInstance( + ['libelle' => 'Unimarc Koha', + 'accents' => self::ENCODING_UTF8, + 'rejet_periodiques' => 0, + 'id_article_periodique' => self::SERIAL_FORMAT_KOHA, + 'type_fichier' => self::FT_RECORDS, + 'format' => self::FORMAT_UNIMARC, + 'attributs' => [ + ['type_doc' => [ + [ 'code' => '0', 'label' => '', 'zone_995' => 'IND' ], + [ 'code' => '1', 'label' => 'am;na', 'zone_995' => 'LIV;LIVJ;LIVA;DOC;MANUEL' ], + [ 'code' => '2', 'label' => 'as', 'zone_995' => 'REV;REVA;REVJ'], + [ 'code' => '3', 'label' => 'i;j', 'zone_995' => 'CD'], + [ 'code' => '4', 'label' => 'g', 'zone_995' => 'DVD;JDVD;DVDA;DVDJ;VID'], + [ 'code' => '5', 'label' => 'l;m', 'zone_995' => 'CDROM;CDR'], + [ 'code' => '6', 'label' => '', 'zone_995' => 'LCD' ], + [ 'code' => '7', 'label' => '', 'zone_995' => 'PAR;JPAR;' ], + [ 'code' => '8', 'label' => '', 'zone_995' => ''], + [ 'code' => '9', 'label' => '', 'zone_995' => ''], + [ 'code' => '10', 'label' => ' ', 'zone_995' => ''], + [ 'code' => '11', 'label' => '', 'zone_995' => 'JVID'], + [ 'code' => '12', 'label' => '', 'zone_995' => 'MAT'], + [ 'code' => '13', 'label' => 'km', 'zone_995' => 'EST'], + [ 'code' => '14', 'label' => '', 'zone_995' => 'TLU'], + [ 'code' => '15', 'label' => '', 'zone_995' => 'CAR'], + [ 'code' => '16', 'label' => '', 'zone_995' => 'DIS'] + ], + 'champ_code_barres' => 'f', + 'champ_cote' => 'k', + 'champ_type_doc' => 'r', + 'champ_genre' => '', + 'champ_section' => 'q', + 'champ_emplacement' => 'e', + 'champ_annexe' => 'b' + ], + ['zone' => '801', + 'champ' => 'c', + 'format' => self::NOVELTY_DATE_FORMAT_AAAA_MM_JJ, + 'jours' => '90', + 'valeurs' => ''] + ] + ] + ); + } + + + public function setAttributs($array_or_string) { + return $this->_set('attributs', + is_array($array_or_string) + ? serialize($array_or_string) + : $array_or_string); + } +} + +?> \ No newline at end of file diff --git a/library/Class/NoticeUnimarc/Writer.php b/library/Class/NoticeUnimarc/Writer.php index 18dd8f28aa81884d61d55b0cd48d9818ffba8d01..53c9e2a2075dcc9b91da7a11502bd43e922f83bc 100644 --- a/library/Class/NoticeUnimarc/Writer.php +++ b/library/Class/NoticeUnimarc/Writer.php @@ -78,13 +78,17 @@ class Class_NoticeUnimarc_Writer extends Class_NoticeUnimarc { // récupération du répertoire $m = 3 + $this->inner_guide['dm1'] + $this->inner_guide['dm2']; $this->directory = substr($this->full_record, self::LABEL_LENGTH, $this->inner_guide['ba'] - 25); + $unimarc_without_label_and_dir = substr($this->full_record, self::LABEL_LENGTH + strlen($this->directory)); + $tmp_dir = array_filter(explode('|', chunk_split($this->directory, $m, '|'))); $dm1 = $this->inner_guide['dm1']; $dm2 = $this->inner_guide['dm2']; $adress_length = 3 + $dm1; - $record = explode("\x1e", $this->full_record); - $label_and_dir = array_shift($record); + $record = explode("\x1e", $unimarc_without_label_and_dir); + // in order to remove errors on missing delimiters on start + while(isset($record[0]) && !trim($record[0])) + array_shift($record); if (count($record)) { foreach ($tmp_dir as $i => $dir) { diff --git a/library/ZendAfi/View/Helper/Notice/ReservationLink.php b/library/ZendAfi/View/Helper/Notice/ReservationLink.php index 952c549724b9a44322cb32cf4a0b4144f6b3982e..9024305729c54fc984275282a5ce02ccc8db169d 100644 --- a/library/ZendAfi/View/Helper/Notice/ReservationLink.php +++ b/library/ZendAfi/View/Helper/Notice/ReservationLink.php @@ -11,12 +11,12 @@ * * 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 + * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Notice_ReservationLink extends Zend_View_Helper_HtmlElement { use Trait_Translator; @@ -44,7 +44,7 @@ class ZendAfi_View_Helper_Notice_ReservationLink extends Zend_View_Helper_HtmlEl if (1 == $this->_bib['INTERDIRE_RESA']) return $html .= ' </td>'; - $type_comm = ($int_bib = Class_IntBib::find($ex['id_bib'])) ? $int_bib->getCommSigb() : 0; + $type_comm = ($int_bib = Class_IntBib::find($ex['id_int_bib'])) ? $int_bib->getCommSigb() : 0; if (!$type_comm) return $this->_renderStandardOn($ex, $html); @@ -62,14 +62,21 @@ class ZendAfi_View_Helper_Notice_ReservationLink extends Zend_View_Helper_HtmlEl /** @return string */ - protected function _renderStandardOn($ex, $html) { - $html .= sprintf('<a href="%s"><img src="%s" border="0" title="%s" alt="%s"/></a>', - BASE_URL . '/recherche/reservation?b=' . $ex["id_bib"] . '&n=' . $ex["id_notice"] . '&cote=' . $ex["cote"], + protected function _renderStandardOn($ex, $html) { + $link = $this->view->url(['controller' => 'recherche', + 'action' => 'reservation', + 'id_int_bib' => $ex['id_int_bib'], + 'id_bib' => $ex['id_bib'], + 'id_notice' => $ex['id_notice'], + 'cote' => $ex['cote']]); + + $html .= sprintf('<a href="%s"><img src="%s" border="0" title="%s" alt="%s"/></a>', + $link, $this->getHoldImage(), $this->_holdLabel, $this->_holdLabel); return $html . '</td>'; - } + } /** @return string */ protected function _renderAjaxOn($ex, $html) { @@ -77,16 +84,11 @@ class ZendAfi_View_Helper_Notice_ReservationLink extends Zend_View_Helper_HtmlEl } - /** @return string */ - protected function _renderPickupAjaxOn($ex, $html) { - return $this->_renderAjaxLinkOn($ex, $html, 'reservationPickup'); - } - - /** @return string */ protected function _renderAjaxLinkOn($ex, $html, $functionName) { $link = $this->view->url(['controller' => 'recherche', 'action' => 'reservation-pickup-ajax', + 'id_int_bib' => $ex['id_int_bib'], 'id_bib' => $ex['id_bib'], 'id_origine' => $ex['id'], 'code_annexe' => $ex['code_annexe']]); diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index b3fd37dbc4cf14dcb5d9a82f336bc6b3220c3147..dd72bfdf2d313c5aa56d78f3fab5f456842305cd 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -421,17 +421,22 @@ class NoticeAjaxControllerExemplairesTest extends AbstractControllerTestCase { $mock_sql = Storm_Test_ObjectWrapper::on(Zend_Registry::get('sql')); Zend_Registry::set('sql', $mock_sql); - $exemplaires = array(array('id_bib' => 99, - 'id_notice' => 123, - 'id' => '6778778778', - 'annexe' => 'MOUL', - 'section' => 'A9', - 'emplacement' => 'emplacement de test', - 'count(*)' => 3, - 'cote' => 'VOD-T-DLJ', - 'dispo' => 'Disponible', - 'date_retour' => 'En mai', - 'code_barres' => '7777734343488')); + $this->fixture('Class_IntBib', ['id' => 4,'comm_sigb' => Class_IntBib::COM_NANOOK]); + + $exemplaires = [ [ + 'id_bib' => 99, + 'id_int_bib' => 4, + 'id_notice' => 123, + 'id' => '6778778778', + 'annexe' => 'MOUL', + 'section' => 'A9', + 'emplacement' => 'emplacement de test', + 'count(*)' => 3, + 'cote' => 'VOD-T-DLJ', + 'dispo' => 'Disponible', + 'date_retour' => 'En mai', + 'reservable' => true, + 'code_barres' => '7777734343488']]; $mock_sql ->whenCalled('fetchAll') diff --git a/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php b/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php index 35384c3c60a9330d8aec46de01288f9b2f3f9b0a..a1b099cb8d0b4d0b1a386111ed84dab11a973beb 100644 --- a/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php +++ b/tests/application/modules/telephone/controllers/RechercheControllerHarryPotterTest.php @@ -389,20 +389,28 @@ class Telephone_RechercheControllerHarryPotterExemplaireReservableTest extends T ->answers($annexe_moulins); - Class_Notice::find(4) - ->setExemplaires([Class_Exemplaire::getLoader() - ->newInstanceWithId(33) - ->setCote('JRROW') - ->setAnnexe('MOUL') - ->setBib(Class_Bib::getLoader() - ->newInstanceWithId(1) - ->setLibelle('Bibliotheque du florilege') - ->setInterdireResa(0)) - ]); + Class_Notice::find(4)->setExemplaires( + [ + $this->fixture( + 'Class_Exemplaire', + [ + 'id' => 33, + 'cote' => 'JRROW', + 'annexe' => 'MOUL', + 'bib' => $this->fixture( + 'Class_Bib', + [ + 'id' => 1, + 'libelle' => 'Bibliotheque du florilege', + 'interdire_resa' => 0 + ]), + 'id_int_bib' => 2, + ]) + ]); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_IntBib') ->whenCalled('find') - ->with(1) + ->with(2) ->answers(Storm_Test_ObjectWrapper::mock() ->whenCalled('getSigbExemplaire') ->answers(Class_WebService_SIGB_Exemplaire::newInstance() diff --git a/tests/library/Class/CommSigbTest.php b/tests/library/Class/CommSigbTest.php index 1d2712f2cd4c003051e90ebe777ebfcd43e5a8f3..401f7e845a786b3b4c34a6bf1b4e94062550f173 100644 --- a/tests/library/Class/CommSigbTest.php +++ b/tests/library/Class/CommSigbTest.php @@ -109,7 +109,7 @@ abstract class CommSigbTestCase extends Storm_Test_ModelTestCase { $this->assertEquals(array(array('id_origine' => '123', 'code_barres' => 'ABC', - 'id_bib' => 5, + 'id_int_bib' => 5, 'dispo' => 'En pret', 'reservable' => true, 'date_retour' => '17/02/1978', @@ -121,7 +121,7 @@ abstract class CommSigbTestCase extends Storm_Test_ModelTestCase { array('id_origine' => '789', 'code_barres' => 'ALM', - 'id_bib' => 8, + 'id_int_bib' => 5, 'annexe' => 8, 'dispo' => 'Sur demande calligraphiee', 'reservable' => false, @@ -134,38 +134,38 @@ abstract class CommSigbTestCase extends Storm_Test_ModelTestCase { array('id_origine' => '666', 'code_barres' => 'PTI', - 'id_bib' => 5, + 'id_int_bib' => 5, 'dispo' => 'non connue', 'reservable' => false)), $this->comm_sigb->getDispoExemplaires(array(array('id_origine' => '123', 'code_barres' => 'ABC', - 'id_bib' => 5, + 'id_int_bib' => 5, 'cote' => 'POT', 'emplacement' => '1'), array('id_origine' => '456', 'code_barres' => 'LOR', - 'id_bib' => 5), + 'id_int_bib' => 5), array('id_origine' => '789', 'code_barres' => 'ALM', - 'id_bib' => 5, + 'id_int_bib' => 5, 'annexe' => 5, 'cote' => 'A', 'emplacement' => '9'), array('id_origine' => '666', 'code_barres' => 'PTI', - 'id_bib' => 5), + 'id_int_bib' => 5), array('id_origine' => '999', 'code_barres' => 'PTP', - 'id_bib' => 5), + 'id_int_bib' => 5), array('id_origine' => '0001', 'code_barres' => 'PTIO', - 'id_bib' => 5)))); + 'id_int_bib' => 5)))); } @@ -574,16 +574,21 @@ class CommSigbWithNotAbonneTest extends Storm_Test_ModelTestCase { /** @test */ public function getDispoExemplairesShouldReturnNonReservable() { - $this->assertEquals([['id' => 2, - 'id_bib' => 0, - 'id_origine' => 0, - 'code_barres' => 0, - 'dispo' => 'non connue', - 'reservable' => false]], - $this->comm_sigb->getDispoExemplaires([['id' => 2, - 'id_origine' => 0, - 'code_barres' => 0, - 'id_bib' => 0]])); + $this->assertEquals([ + [ + 'id' => 2, + 'id_int_bib' => 0, + 'id_origine' => 0, + 'code_barres' => 0, + 'dispo' => 'non connue', + 'reservable' => false] + ], + $this->comm_sigb->getDispoExemplaires([ + [ + 'id' => 2, + 'id_origine' => 0, + 'code_barres' => 0, + 'id_int_bib' => 0]])); } } diff --git a/tests/library/Class/ExemplaireTest.php b/tests/library/Class/ExemplaireTest.php index 1ff719bd4867e17130cb6f967ccdde7e72202dde..2bed1b7351c0ad5b1e321bafe35ffb4fd6184228 100644 --- a/tests/library/Class/ExemplaireTest.php +++ b/tests/library/Class/ExemplaireTest.php @@ -43,14 +43,14 @@ class Class_ExemplaireTest extends Storm_Test_ModelTestCase { /** @test */ public function exemplaireIsNotSigbExemplaireShouldNotBeReservable() { - $bib=Storm_Test_ObjectWrapper::mock() + $int_bib=Storm_Test_ObjectWrapper::mock() ->whenCalled('getId') ->answers('2') ->whenCalled('getSigbExemplaire') ->answers(null); $exemplaire = Class_Exemplaire::newInstanceWithId(34, ['notice'=>Class_Notice::newInstanceWithId(12), - 'bib'=>$bib]); + 'int_bib'=>$int_bib]); $this->assertFalse($exemplaire->isReservable()); } diff --git a/tests/library/Class/IntBibTest.php b/tests/library/Class/IntBibTest.php new file mode 100644 index 0000000000000000000000000000000000000000..afff810376ffe26ff91a34301d39637d949bd0ca --- /dev/null +++ b/tests/library/Class/IntBibTest.php @@ -0,0 +1,50 @@ +<?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 + */ + + +class IntBibTest extends Storm_Test_ModelTestCase { + public function setUp() { + parent::setUp(); + $this->fixture('Class_IntBib', ['id' => 3, + 'nom' => null, + 'nom_court' => 'An', + 'bib' => $this->fixture('Class_Bib', ['id' => 2, + 'libelle' => 'Annecy'])]); + + $this->fixture('Class_IntBib', ['id' => 4, + 'nom' => null, + 'nom_court' => 'Cran', + 'bib' => null]); + } + + + /** @test */ + public function annecyLibelleShouldBeAnnecy() { + $this->assertEquals('Annecy', Class_IntBib::find(3)->getLabel()); + } + + + /** @test */ + public function cranLibelleShouldBeCran() { + $this->assertEquals('Cran', Class_IntBib::find(4)->getLabel()); + } +} +?> \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/Notice/ExemplairesTest.php b/tests/library/ZendAfi/View/Helper/Notice/ExemplairesTest.php index 5b36fbc1192e16e5cc227b6b65516772d9cd497d..ec3c03b6d77b79046f9b219c62c034e91d5c1849 100644 --- a/tests/library/ZendAfi/View/Helper/Notice/ExemplairesTest.php +++ b/tests/library/ZendAfi/View/Helper/Notice/ExemplairesTest.php @@ -49,14 +49,16 @@ class NoticeHtmlGetExemplairesWithOneExemplaireNoWebServiceTest extends ZendAfi_ public function setUp() { parent::setUp(); Class_Profil::setCurrentProfil(new Class_Profil()); - $exemplaire = array('id_bib' => -1, - 'id_notice' => '24765', - 'annexe' => 'MOUL', - 'count(*)' => 2, //??? - 'cote' => 'DSEM', - 'dispo' => "Disponible", - 'code_barres' => "12345"); - $this->html = $this->_helper->Notice_Exemplaires(array($exemplaire)); + $exemplaire = [ + 'id_bib' => -1, + 'id_int_bib' => 0, + 'id_notice' => '24765', + 'annexe' => 'MOUL', + 'count(*)' => 2, //??? + 'cote' => 'DSEM', + 'dispo' => "Disponible", + 'code_barres' => "12345"]; + $this->html = $this->_helper->Notice_Exemplaires([$exemplaire]); } @@ -67,11 +69,19 @@ class NoticeHtmlGetExemplairesWithOneExemplaireNoWebServiceTest extends ZendAfi_ /** @test */ - public function reservationLinkShouldNotBeVisible() { + public function reservationLinkShouldNotBePopup() { $this->assertNotXPath($this->html, '//a[@data-popup="true"]'); } + + /** @test */ + public function reservationLinkShouldBeRechercheReservation() { + $this->assertXPath( + $this->html, + '//a[contains(@href, "recherche/reservation/id_int_bib/0/id_bib/-1/id_notice/24765/cote/DSEM")]'); + } + /** @test **/ public function coteShouldNotContainsSpan() { $this->assertNotXPathContentContains($this->html, '//td', utf8_encode('DSEM<span></span>'),$this->html); @@ -98,17 +108,18 @@ abstract class NoticeHtmlGetExemplairesWithOneExemplaireAndWebServiceTestCase ex Class_Profil::getLoader() ->newInstanceWithId(4) - ->setCfgNotice(array('exemplaires' => array('grouper' => 1, - 'bib' => 1, - 'annexe' => 1, - 'section' => 1, - 'emplacement' => 1, - 'dispo' => 1, - 'date_retour' => 1, - 'localisation' => 1, - 'plan' => 1, - 'resa' => 1))) - ->beCurrentProfil(); + ->setCfgNotice(['exemplaires' => [ + 'grouper' => 1, + 'bib' => 1, + 'annexe' => 1, + 'section' => 1, + 'emplacement' => 1, + 'dispo' => 1, + 'date_retour' => 1, + 'localisation' => 1, + 'plan' => 1, + 'resa' => 1]]) + ->beCurrentProfil(); Class_IntBib::getLoader() @@ -125,7 +136,8 @@ abstract class NoticeHtmlGetExemplairesWithOneExemplaireAndWebServiceTestCase ex ->getWrapper()); $this->exemplaire = ['id' => 12, - 'id_bib' => 1, + 'id_bib' => 4, + 'id_int_bib' => 1, 'id_notice' => '24765', 'id_origine' => '666', 'annexe' => 'MOUL', @@ -162,7 +174,7 @@ extends NoticeHtmlGetExemplairesWithOneExemplaireAndWebServiceTestCase { /** @test */ public function reservationLinkShouldBePopup() { $this->assertXPath($this->html, - '//a[@data-popup="true"][contains(@href, "recherche/reservation-pickup-ajax/id_bib/1/id_origine/12/code_annexe/MOUL")]'); + '//a[@data-popup="true"][contains(@href, "recherche/reservation-pickup-ajax/id_int_bib/1/id_bib/4/id_origine/12/code_annexe/MOUL")]'); } @@ -221,7 +233,7 @@ extends NoticeHtmlGetExemplairesWithOneExemplaireAndWebServiceTestCase { /** @test */ public function reservationLinkShouldBePopup() { $this->assertXPath($this->html, - '//a[@data-popup="true"][contains(@href, "recherche/reservation-pickup-ajax/id_bib/1/id_origine/12/code_annexe/MOUL")]'); + '//a[@data-popup="true"][contains(@href, "recherche/reservation-pickup-ajax/id_int_bib/1/id_bib/4/id_origine/12/code_annexe/MOUL")]'); } }