From 4a869626eca2a8180ddb1ed1a24a87607a78d98d Mon Sep 17 00:00:00 2001 From: Alex Arnaud <alex.arnaud@biblibre.com> Date: Mon, 28 Jul 2014 16:45:49 +0200 Subject: [PATCH] hotline#13648 - Add special character handling for quotes and double quotes. --- .../php/classes/NoticeIntegrationTest.php | 20 +++++++++++++++---- library/Class/NoticeUnimarc/Writer.php | 5 ++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index cf686dc3b7f..2b2639787e7 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -1240,22 +1240,34 @@ class NoticeIntegrationKohaPeriodiqueTest extends NoticeIntegrationTestCase { class NoticeIntegrationBiblioArcheoAnimauxTest extends NoticeIntegrationTestCase { + protected $_profil_donnees = [ + 'id_profil' => 111, + 'libelle' => 'Unimarc Aloes', + 'accents' => 1, + 'rejet_periodiques' => 1, + 'id_article_periodique' => 2, + 'type_fichier' => 0, + 'format' => 0, + 'attributs' => 'a:7:{i:0;a:8:{s:8:"type_doc";a:11:{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:9:"LIV;MS;az";}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:20:"DIAPO;DVD;VHS;VHD;VD";}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:0:"";s:8:"zone_995";s:2:"uu";}i:7;a:3:{s:4:"code";s:1:"8";s:5:"label";s:0:"";s:8:"zone_995";s:3:"DOS";}i:8;a:3:{s:4:"code";s:1:"9";s:5:"label";s:0:"";s:8:"zone_995";s:0:"";}i:9;a:3:{s:4:"code";s:2:"10";s:5:"label";s:0:"";s:8:"zone_995";s:6:"WEB;MF";}i:10;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:"a";}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:"995";s:5:"champ";s:1:"x";s:6:"format";s:1:"3";s:5:"jours";s:0:"";s:7:"valeurs";s:1:"N";}i:6;a:2:{s:4:"zone";s:0:"";s:5:"champ";s:0:"";}}' + ]; + public function setUp() { parent::setUp(); $this->loadNotice('unimarc_archeo_animaux'); + $this->notice_sgbd->ouvrirNotice($this->notice_integration->noticeToDBEnreg($this->notice_data)['unimarc'], 0); } /** @test */ public function field200AShouldBeAsExpected() { - $this->assertEquals('ArchÂeo animaux',$this->notice_sgbd->get_subfield('200', 'a')[0]); + $this->assertEquals('ArchAeo animaux',$this->notice_sgbd->get_subfield('200', 'a')[0]); } /** @test */ public function field200EShouldBeAsExpected() { - $this->assertEquals("l'incroyable histoire de l'archÂeologie des animaux",$this->notice_sgbd->get_subfield('200', 'e')[0]); + $this->assertEquals("l'incroyable histoire de l'archAeologie des animaux",$this->notice_sgbd->get_subfield('200', 'e')[0]); } @@ -1268,7 +1280,7 @@ class NoticeIntegrationBiblioArcheoAnimauxTest extends NoticeIntegrationTestCase /** @test */ public function field200GShouldBeLamysHachem() { - $this->assertEquals("ill. d'HÂelÃene Georges",$this->notice_sgbd->get_subfield('200', 'g')[0]); + $this->assertEquals("ill. d'HAelÃene Georges",$this->notice_sgbd->get_subfield('200', 'g')[0]); } @@ -1316,7 +1328,7 @@ class NoticeIntegrationBiblioArcheoAnimauxTest extends NoticeIntegrationTestCase /** @test */ public function unimarc330ShoulBeAsExpected() { - $this->assertEquals('Documentaire dÂ’une trÃes grande qualitÂe qui permet dÂ’apprendre ce quÂ’est lÂ’archÂeozoologie (lÂ’archÂeologie appliquÂee aux dÂecouvertes animales) et de dÂecouvrir les mÂethodes et techniques utilisÂees par les professionnels. Un livre enrichissant, Ãa conseiller aux enfants comme aux adultes, pour en savoir plus sur les diffÂerents rÃoles des animaux auprÃes des hommes au fil des Âepoques et l’Âevolution des modes de vie, et dÂecouvrir les divers aspects du mÂetier passionnant dÂ’archÂeozoologue. A noter : ce livre a remportÂe le prix « Le GoÃut des sciences 2013 », (catÂegorie « La science expliquÂee aux jeunes »).', $this->notice_sgbd->get_subfield('330', 'a')[0]); + $this->assertEquals('Documentaire d\'une trÃes grande qualitAe qui permet d\'apprendre ce qu\'est l\'archAeozoologie (l\'archAeologie appliquAee aux dAecouvertes animales) et de dAecouvrir les mAethodes et techniques utilisAees par les professionnels. Un livre enrichissant, Ãa conseiller aux enfants comme aux adultes, pour en savoir plus sur les diffAerents rÃoles des animaux auprÃes des hommes au fil des Aepoques et l\'Aevolution des modes de vie, et dAecouvrir les divers aspects du mAetier passionnant d\'archAeozoologue. A noter : ce livre a remportAe le prix " Le GoÃut des sciences 2013 ", (catAegorie " La science expliquAee aux jeunes ").', $this->notice_sgbd->get_subfield('330', 'a')[0]); } } diff --git a/library/Class/NoticeUnimarc/Writer.php b/library/Class/NoticeUnimarc/Writer.php index e32f08606da..433c98a9f06 100644 --- a/library/Class/NoticeUnimarc/Writer.php +++ b/library/Class/NoticeUnimarc/Writer.php @@ -499,7 +499,10 @@ class Class_NoticeUnimarc_Writer extends Class_NoticeUnimarc { chr(0xf9) =>'ø', chr(0xfb) =>'ß', chr(0x80) =>'€', - chr(0x92) =>'\'' ]; + chr(0xc2).chr(0xab) => '"', + chr(0xc2).chr(0xbb) => '"', + chr(0xc2).chr(0x92) => '\'', + chr(0x92) => '\'' ]; $this->_iso_decode_table_2709 = array_keys($this->_iso_decode_table); $this->_iso_decode_table_utf8 = array_values($this->_iso_decode_table); -- GitLab