diff --git a/VERSIONS_HOTLINE/109561 b/VERSIONS_HOTLINE/109561 new file mode 100644 index 0000000000000000000000000000000000000000..5f10d19053cdb3c8a0f8ee24248c490fdb0f98cf --- /dev/null +++ b/VERSIONS_HOTLINE/109561 @@ -0,0 +1 @@ + - ticket #109561 : Moissonnage Dilicom : Intégrer les Balises Subject dans les mots matières \ No newline at end of file diff --git a/library/Class/WebService/BibNumerique/Dilicom/ONIXFile.php b/library/Class/WebService/BibNumerique/Dilicom/ONIXFile.php index 61d7ba385c49bf240ed099c13947f976a9be7d3f..fb4d8659fad8d68a4c83cafc7e629189ecf91f24 100644 --- a/library/Class/WebService/BibNumerique/Dilicom/ONIXFile.php +++ b/library/Class/WebService/BibNumerique/Dilicom/ONIXFile.php @@ -32,7 +32,8 @@ class Class_WebService_BibNumerique_Dilicom_ONIXFile { RESOURCE_CONTENT_TYPE_WIDGET = '16', USAGE_UNIT_DAYS = '09', USAGE_UNIT_MONTHS = '14', - USAGE_UNIT_USERS = '07'; + USAGE_UNIT_USERS = '07', + SUBJECT_SCHEME_IDENTIFIER_CLIL = '29'; protected $_parser, @@ -46,6 +47,9 @@ class Class_WebService_BibNumerique_Dilicom_ONIXFile { $_current_usage_constraint, $_current_quantity, $_current_usage_unit, + $_current_subject_label, + $_current_subject_scheme_identifier, + $_current_subject_scheme_version, $_tag_mapping = ['B203' => 'TitleText', 'B221' => 'ProductIDType', 'B244' => 'IDValue', @@ -111,6 +115,36 @@ class Class_WebService_BibNumerique_Dilicom_ONIXFile { } + public function endSubjectHeadingText($content) { + $this->_current_subject_label = $content; + } + + + public function endSubjectSchemeIdentifier($content) { + $this->_current_subject_scheme_identifier = $content; + } + + + public function endSubjectSchemeVersion($content) { + $this->_current_subject_scheme_version = $content; + } + + + public function endSubject($content) { + if ($this->_current_subject_scheme_identifier == self::SUBJECT_SCHEME_IDENTIFIER_CLIL) + $this->_book->addMatiere($this->_current_subject_label); + $this->_resetSubject(); + } + + + protected function _resetSubject(){ + $this->_current_subject_label = null; + $this->_current_subject_scheme_identifier = null; + $this->_current_subject_scheme_version = null; + return $this; + } + + public function endIDValue($content) { $this->_current_product_id_value = $content; } diff --git a/tests/scenarios/PnbDilicom/PnbDilicomTest.php b/tests/scenarios/PnbDilicom/PnbDilicomTest.php index 50aec920e80d55cb118b71276d6b7f125306ec7b..fad70b72fd3edabd712b3b346e9251ba529650c0 100644 --- a/tests/scenarios/PnbDilicom/PnbDilicomTest.php +++ b/tests/scenarios/PnbDilicom/PnbDilicomTest.php @@ -622,6 +622,7 @@ class PnbDilicomRiviereEsperanceOffersParserTest extends PnbDilicomOfferParserTe $books = Class_WebService_BibNumerique_Dilicom_PNBOffersFile::booksFromXML($this->_xml); $books[0]->import(); $this->_item = Class_Album_Item::find(1); + $this->_album = Class_Album::find(1); } @@ -637,6 +638,17 @@ class PnbDilicomRiviereEsperanceOffersParserTest extends PnbDilicomOfferParserTe $this->assertEquals(50, $this->_item->getUsageConstraints()->getLoanQuantity()); } + + /** @test */ + public function albumMatiereShouldContains1() { + $this->assertContains('1',$this->_album->getMatiere()); + } + + + /** @test */ + public function codifMatiereOneShouldBeContesEtLegendesTerroir() { + $this->assertEquals('Contes et légendes / Terroir', Class_CodifMatiere::find(1)->getLibelle()); + } } @@ -1116,6 +1128,7 @@ class PnbDilicomBatchJobOnixWithFullTest extends PnbDilicomJobOnixTestCase { Class_Album::find(1)->index(); $this->assertNotNull(Class_Exemplaire::findFirstBy(['id_origine' => 'Dilicom-9782290123409'])); $this->assertNotNull(Class_Album::find(1)->getNotice()); + $this->assertEquals('Dilicom-9782290123409', Class_Notice::find(1)->getAlbum()->getIdOrigine()); } @@ -1125,6 +1138,18 @@ class PnbDilicomBatchJobOnixWithFullTest extends PnbDilicomJobOnixTestCase { Class_Album::find(1)->index(); $this->assertEquals('2015-07-10 13:12:43', Class_Album::find(1)->getNotice()->getDateCreation()); } + + + /** @test */ + public function NoticeUnimarcMatieresLabelShouldBeRomansdeScienceFictionRomansClassiques() { + Class_Album::find(1)->index(); + Class_CosmoVar::set('unimarc_zone_matiere',"610a"); + $this->assertEquals(['Romans de science-fiction, terreur, épouvante', + 'Romans classiques', + 'Oeuvres classiques', + 'Fantasy, Merveilleux', + 'LITTÉRATURE GÉNÉRALE'], Class_Album::find(1)->getNotice()->getNoticeUnimarc()->getMatieresLabels()); + } }