diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index be72a4503f9215213a09969b0290fa8996cfc96b..1d3e20ae11d893d3f05a46abb34cd87d30066000 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -435,14 +435,13 @@ class notice_integration { private function chercheNotice() { $attributes = []; if(!$this->mode_doublon) - $attributes = [//'isbn10' => $this->notice['isbn10'], - //'isbn13' => $this->notice['isbn13'], - 'isbn' => [$this->notice['isbn13'], $this->notice['isbn10']], - 'ean' => $this->notice['ean'], - 'id_commerciale' => $this->notice['id_commerciale']]; + $attributes = [['isbn', $this->notice['isbn13']], + ['isbn', $this->notice['isbn10']], + ['ean', $this->notice['ean']], + ['id_commerciale', $this->notice['id_commerciale']]]; if ($this->mode_doublon == static::SEARCH_MODE_ALPHAKEY) - $attributes = ['clef_alpha' => $this->notice['clef_alpha']]; + $attributes = [['clef_alpha', $this->notice['clef_alpha']]]; $this->identification = ['statut' => static::STATUS_NOTFOUND]; @@ -453,7 +452,9 @@ class notice_integration { return $id_notice; } - foreach ($attributes as $key => $value) { + foreach ($attributes as $attr) { + list($key, $value) = $attr; + if ($id_notice = $this->searchRecordBy($key, $value)) { $this->identification['statut'] = $key; $this->identification[$key] = $id_notice; diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationDedupTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationDedupTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e0274469b744326392ff8c3ff9c61f8378176ef6 --- /dev/null +++ b/cosmogramme/tests/php/classes/NoticeIntegrationDedupTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +require_once 'NoticeIntegrationTest.php'; + +/** @see http://forge.afi-sa.fr/issues/17196 */ +class NoticeIntegrationDedupWithoutIsbnTest extends NoticeIntegrationTestCase { + public function getProfilDonnees() { + return Class_IntProfilDonnees::forALOES()->setIdProfil(113) + ->getRawAttributes(); + } + public function setUp() { + parent::setUp(); + $this->fixture('Class_Notice', ['id' => 15824768, + 'type_doc' => 2, + 'alpha_titre' => 'ANIME LAND 203', + 'alpha_auteur' => 'ANIMARTE', + 'titres' => 'ANIME ANIM LAND LAN MAGAZINE MAGAZIN FRANCAIS FRANKAI L00 ANIMATION ANIMASION 203', + 'auteurs' => 'ANIMARTE ANIMART', + 'editeur' => 'Animarte', + 'dewey' => 'ARTS AR LOISIRS LOISIR', + 'facettes' => 'D7948083 A204019 Lfre G4 G9 G37 G18 G12 G10 G33 G11 G45 G17 G5 G14 G2 G13 G8 G7 G30 G19 G24 G21 G20 G43 G3 G16 G51 G47 G27 G29 G36 G25 G34 G31 G56 G53 G1 G28 G26 G44 G32 G23 G6 G58 G50 T2 B105 S6 YVIGNEULLES B4 S1 S10 B3 YLIGNY S7 B18 YAUBREVILLE B81 YPIERREFITT B40 YDUGNY B53 YLACROIXSME B39 YDOULCON B20 YBELLEVILLE B58 YISLETTES B7 YSTM B94 YSPINCOURT B130 YTRIAUCOURT B26 YBRAS B96 YTREMONT B35 YDAMVILLERS B80 YPAGNY B8 YDIEUE B33 YCOUSANCE B73 YMONTMEDY B126 YCDOS B29 YCLERMONTAR B42 YFRESNES B57 YLEROUVILLE B124 YSOUILLY B41 YETAIN B11 YLAMORVILLE B1 YBDM B101 YVAUBECOURT', + 'cote' => '741.5 ANI', + 'id_commerciale' => '', + 'id_bnf' => '', + 'ean' => null, + 'clef_alpha' => 'ANIMELAND-LEMAGAZINEFRANCAISDE-ANIMARTE-203-ANIMARTE-1991-2', + 'clef_oeuvre' => 'ANIMELAND-LEMAGAZINEFRANCAISDE-ANIMARTE-203', + 'clef_chapeau' => 'ANIME LAND', + 'tome_alpha' => 203, + 'annee' => 1991, + 'qualite' => 5, + 'exportable' => 1, + 'date_creation' => '2015-08-13 00:00:00', + 'date_maj' => '2015-04-19 03:56:21', + 'unimarc' => "01281cas0 2200373 450 0010007000000110027000070200013000340900011000471000041000581010008000991020007001071060006001141100016001202000114001362070023002502100056002732100045003292100070003742150010004443000072004543120037005263260011005634610015005744610008005894610023005974880055006205170014006755300015006896760018007046860070007227100060007928010048008528020007009001588661 a1148-0807dle n° 20 F b19104668 a158866 a19910613a1991 m y0frey50 ba0 afre aFR ar aah z z 1 aAnime landbTexte impriméele magazine français de l'animationf[Animarte]g[dir. publ. Yvan West Laurence] 0aN° 1 (1991, avr.) aVanvesb71 rue Jean-Jaurès, 92170cAnimarted1991-0 aParisb7 rue Elie Faure, 75012cAnimarte1 aParisb14 rue Soleillet, 75971 Cedex 20cAnime manga pressd1996- d30 cm aCertains numéros sont accompagnés d'un DVD-ROM ou d'un DVD vidéo aAutre forme de titre : Animeland aBimest11tAnime land11v20311o- Avril / Mai 2015 1036140168tAnime land. Hors-sériex1283-6338d19971 aAnimeland0 aAnime land a794.808 3v22 a0002Cadre de classement de la Bibliographie nationale française 312883488aAnimartecVanves, Hauts-de-Seine40709161742 0aFRbFR-751131015c19910613gAFNOR2intermrc a07", + ]); + + VariableCache::getInstance() + ->setValeurCache(['filtrer_fulltext' => 1, + 'mode_doublon'=> 0, + 'tracer_accents_iso'=>1, + 'non_exportable'=> 'electre;decitre;gam;zebris', + 'controle_codes_barres'=> 0, + 'unimarc_zone_titre' => '200$a;461$t', + 'unicite_code_barres' => 0, + 'champs_sup' => '', + 'ean_345' => '']); + + $this->loadNotice('unimarc_dernier_des_hommes'); + } + + + /** @test */ + public function thereShouldHave2Records() { + $this->assertEquals(2, Class_Notice::count()); + } +} diff --git a/cosmogramme/tests/php/classes/unimarc_dernier_des_hommes.txt b/cosmogramme/tests/php/classes/unimarc_dernier_des_hommes.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ca4e572879b1d2774166daee9a197ef552ca010 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_dernier_des_hommes.txt @@ -0,0 +1 @@ +01683ngm0 2200361 450 0010008000000200017000080710022000251000041000471010028000881020007001161150025001232000164001482100050003122150086003623000203004483000131006513040042007823060016008243300071008403450027009116860008009387020046009467020032009927020024010247020025010487020021010738010039010948010025011339010047011589020020012059030008012259950088012330476549 aFRb70502749|1bMK2 Âed.a9714900 a20050119d2005 y0frey0103 ba1 amulcgerjengjfrejspa aFR ac baiz|||||||bz||c1 aDernier des hommes (Le)bImages animÂeesfFriedrich Wilhelm Murnau, rÂeal.gCarl Mayer, scÂenariogEmil Jannings, Maly Delscharft, Max Hiller... [et al.], act. a[Paris]cMK2 Âed. [Âed., distrib.]d[DL 2005] a1 DVD vidÂeo monoface double couche zone 2 (2 h 10 min)c4/3, n. et b. (PAL), mu. aContient aussi : rÂealisation du "Dernier des hommes" par Luciano Berriatua (40 min), crÂeateurs du film, gÂenÂerique, le film est prÂesentÂe avec sa double fin, la deuxiÁeme Âetant la fin originale aFilm muet avec intertitres en allemand et sous-titrage optionnel en anglais, franÐcais et espagnol avec accompagnement musical aNotice rÂedigÂee d'aprÁes la jaquette aCop. : 1924 a"L'histoire de la decheance du portier d'un grand hotel de Berlin" b3700224303952d56,00 € a207 |aMurnaubFriedrich Wilhelmf1888-19314300 |aMayerbCarlf1894-19444690 |aJanningsbEmil4005 |aDelschaftbMaly4005 |aHillerbMax4005 0aFRbBNFc20050119gAFNOR2intermrc 0aFRbBM BLDc20070929 aCinÂema -- Allemagne [Europe] -- 1895-1928 aFilm dramatique aP14 30476707aMÂediathÁeque Jean JEUKENSf10086587kF MUR DVDm20140712n20140823qargd \ No newline at end of file