diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index bffeb322c11296f553a428ab657915459c194858..aade91d77006979eb4a113d3a2eb2ac90e78cf9a 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -637,7 +637,7 @@ class notice_integration { $this->statut = static::RECORD_UPDATE; // Zones forcees - $this->notice_sgbd->ouvrirNotice($unimarc, $this->id_profil); + $this->notice_sgbd->ouvrirNotice($unimarc, $this->id_profil, 0, '', false); $champs_forces = $this->notice_sgbd->getChampsForces(); $id_origine = $this->notice["id_origine"]; @@ -648,7 +648,7 @@ class notice_integration { // Si la notice de la base est de meilleure qualite on la prend if ($this->statut == static::RECORD_RENEW) - $this->notice_sgbd->ouvrirNotice($this->notice["unimarc_with_items"], $this->id_profil); + $this->notice_sgbd->ouvrirNotice($this->notice["unimarc_with_items"], $this->id_profil, 0, '', false); $this->updateForcedZones($champs_forces, $this->notice["champs_forces"]); $this->notice = $this->notice_sgbd->getNoticeIntegration(); diff --git a/cosmogramme/php/classes/classe_unimarc.php b/cosmogramme/php/classes/classe_unimarc.php index 020c9cb3f7ad189f555f51b6f9ba3fc44c1fc0e1..a7bbb8505d32bb1816570b222cac865d33f7ef15 100644 --- a/cosmogramme/php/classes/classe_unimarc.php +++ b/cosmogramme/php/classes/classe_unimarc.php @@ -59,7 +59,7 @@ class notice_unimarc extends iso2709_record { } - public function ouvrirNotice($data, $id_profil, $sigb=0, $type_doc_force='') { + public function ouvrirNotice($data, $id_profil, $sigb=0, $type_doc_force='', $decode_string = true) { $this->type_doc_force['label'] = $type_doc_force; $type_doc_map = ['a' => '1', 'j' => '3', 'g' => '4', 'l' => '5', 'c' => '6', 'f' => '7']; @@ -75,6 +75,10 @@ class notice_unimarc extends iso2709_record { else $this->profil = $this->profil_unimarc->getProfil($this->id_profil); + if (!$decode_string) { + $this->profil['accents'] = 0; + } + $this->setNotice($data, $this->profil['accents']); return true; } diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index 7a8071c8d7ff2af9654aa669deec4d35b424209e..bb137d4f2ba89a34ddd03688f37f94b084fce8e6 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -1867,4 +1867,28 @@ class NoticeIntegrationMarioCartWiiTest extends NoticeIntegrationTestCase { $this->assertEquals($location, $item->getEmplacement(), json_encode($item->getRawAttributes())); } +} + +class NoticeIntegrationAloesTest extends NoticeIntegrationTestCase { + public function setUp() { + parent::setUp(); + Class_Notice::beVolatile(); + $this->loadNotice('unimarc_sieste_des_mamans'); + $this->loadNotice('unimarc_sieste_des_mamans'); + } + + + public function getProfilDonnees() { + return Class_IntProfilDonnees::forALOES() + ->setIdProfil(111) + ->getRawAttributes(); + } + + + /** @test */ + public function EuroSymbolShouldBeWellEncoded() { + $unimarc = new Class_NoticeUnimarc(); + $unimarc->setNotice(Class_Notice::find(1)->getUnimarc()); + $this->assertEquals('12 €', $unimarc->get_subfield('010', 'd')[0]); + } } \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/unimarc_sieste_des_mamans.txt b/cosmogramme/tests/php/classes/unimarc_sieste_des_mamans.txt new file mode 100644 index 0000000000000000000000000000000000000000..51e4503efb25a785c8cfe48925ccffb31a96af70 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_sieste_des_mamans.txt @@ -0,0 +1 @@ +00977nam0 2200229 450 0010008000000100024000080290012000321000041000441010013000851020007000982000068001052100041001732150040002143300291002546100025005457000025005707020025005958010036006209020006006569030006006629950079006680113407 a2-08-161019-1d12 € a0071867 a20000024d2000 y0frey0103 ba| afrecfre aFR| aSieste des mamans (La)fAgnÁes Bertrongill. par Olivier Tallec aPariscPÁere castor Flammariond2000 a(30) p.ctout ill. en coul.d27 cm. aQuelque part en Afrique, Maman ElÂephant, Maman Croco et Maman Singe n'en peuvent plus. A force de courir d'un enfant Áa l'autre sans jamais s'arrÃeter, elles ont un urgent, un indispensable, un irrÂepressible besoin de faire la sieste. Un jour, elles se retrouvent au bord d'une oasis.| aFille-garÐcon (site) |aBertronbAgnÁes4070 |aTallecbOlivier4440 |aFRbBM Vaulx-en-Velinc20000024 aa aJ 30253205aBibliothÁeque M.G. Chassineb05f4902065397kJ A BER SIE qCraz \ No newline at end of file