diff --git a/VERSIONS_HOTLINE/109570 b/VERSIONS_HOTLINE/109570 new file mode 100644 index 0000000000000000000000000000000000000000..8d0612279d5f9470f3c2a1198bd6e2b6fa9e9763 --- /dev/null +++ b/VERSIONS_HOTLINE/109570 @@ -0,0 +1 @@ + - ticket #109570 : Correction de la mise à jour des notices d'autorités \ No newline at end of file diff --git a/library/Class/Cosmogramme/Integration/Record/Authority.php b/library/Class/Cosmogramme/Integration/Record/Authority.php index ce051f842a4aee4d88382a8e5fdf3a23bc031348..0ac248b9808504cea7d3032ffeabc91dfe060c14 100644 --- a/library/Class/Cosmogramme/Integration/Record/Authority.php +++ b/library/Class/Cosmogramme/Integration/Record/Authority.php @@ -81,7 +81,7 @@ class Class_Cosmogramme_Integration_Record_Authority { $record = $this->_save($relation->id(), ['unimarc' => $marc, - 'type' => Class_Notice::TYPE_AUTHORITY, + 'type' => Class_Notice::TYPE_AUTHORITY_PARTIAL, 'type_doc' => $relation->authorityType(), 'titres' => $this->_indexation->getFulltext($relation->label()), 'alpha_titre' => $this->_indexation->codeAlphaTitre($relation->label())]); @@ -114,6 +114,8 @@ class Class_Cosmogramme_Integration_Record_Authority { protected function _insert($item, $record) { + $record['type'] = Class_Notice::TYPE_AUTHORITY; + $new_record = Class_Notice::newInstance($record); $new_record ->setDateMaj($this->getTimeSource()->dateDayAndHours()) @@ -133,8 +135,7 @@ class Class_Cosmogramme_Integration_Record_Authority { $item->setToDelete(false)->save(); - if (($catalog_agency = $existing_record->get_subfield('801', 'b')) - && Class_Notice_AuthorityPartial::DEFAULT_AGENCY === $catalog_agency[0]) + if ($record['type'] == Class_Notice::TYPE_AUTHORITY) $existing_record->updateAttributes($record); $existing_record diff --git a/library/Class/Notice.php b/library/Class/Notice.php index 99c84a7bce2a3976d9c84061d61063ab4b2d36d0..568d2e310bd159a2206c79e9e0c4ef2251f9673a 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -173,7 +173,8 @@ class Class_Notice extends Storm_Model_Abstract { const TYPE_BIBLIOGRAPHIC = 1, TYPE_AUTHORITY = 2, - TYPE_SERIAL_ARTICLE = 3; + TYPE_SERIAL_ARTICLE = 3, + TYPE_AUTHORITY_PARTIAL = 4; protected $_loader_class = 'NoticeLoader', diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseAuthorityTest.php b/tests/library/Class/Cosmogramme/Integration/PhaseAuthorityTest.php index 3a77c89121f85b64e299a13db74a1d583c02ba2f..db9b4ef4327b8388bedb78f1d89281249dfb3121 100644 --- a/tests/library/Class/Cosmogramme/Integration/PhaseAuthorityTest.php +++ b/tests/library/Class/Cosmogramme/Integration/PhaseAuthorityTest.php @@ -67,6 +67,15 @@ class PhaseAuthorityTest extends Class_Cosmogramme_Integration_PhaseTestCase { 'fichier' => 'authorities_tess_mini.mrc', 'pointeur_reprise' => 0]); + $this->fixture('Class_Cosmogramme_Integration', + ['id' => 1000, + 'bib' => Class_IntBib::find(2), + 'profil_donnees' => Class_IntProfilDonnees::find(102), + 'type_operation' => Class_Cosmogramme_Integration::TYPE_OPERATION_INCREMENT, + 'traite' => 'non', + 'fichier' => 'authorities_tess_mini_update.mrc', + 'pointeur_reprise' => 0]); + $this->fixture('Class_CodifThesaurus', ['id' => 5, 'id_thesaurus' => 'HMOTS', @@ -95,8 +104,8 @@ class PhaseAuthorityTest extends Class_Cosmogramme_Integration_PhaseTestCase { /** @test */ - public function shouldHave28Records() { - $this->assertEquals(28, Class_Notice::countBy(['type' => Class_Notice::TYPE_AUTHORITY])); + public function shouldHave30Records() { + $this->assertEquals(30, Class_Notice::countBy(['type' => Class_Notice::TYPE_AUTHORITY])); } @@ -143,6 +152,25 @@ class PhaseAuthorityTest extends Class_Cosmogramme_Integration_PhaseTestCase { } + + /** + * @test + * @depends amenagementDuTerritoireShouldExists + */ + public function amenagementDuTerritoireShouldHaveLinkToFacetCoffeeMachine190001($record) { + $this->assertContains('h190001', $record->getFacettes()); + } + + + /** + * @test + * @depends amenagementDuTerritoireShouldExists + */ + public function amenagementDuTerritoireShouldKeep550OuvrageArtAfterUpdate($record) { + $this->assertContains('Ouvrage d\'art', $record->get_subfield('550', 'a')); + } + + /** * @test * @depends amenagementDuTerritoireShouldExists diff --git a/tests/library/Class/Cosmogramme/Integration/authorities_tess_mini_update.mrc b/tests/library/Class/Cosmogramme/Integration/authorities_tess_mini_update.mrc new file mode 100644 index 0000000000000000000000000000000000000000..a9dd42abf13db125c497f5ee8f5df0c318a6233a --- /dev/null +++ b/tests/library/Class/Cosmogramme/Integration/authorities_tess_mini_update.mrc @@ -0,0 +1 @@ +01020 a2200289 450000500170000010000290001715200090004625000310005555000420008655000360012855000360016455000280020055000360022855000400026455000410030455000320034555000490037755000400042655000340046655000290050055000260052955000540055555000460060955000300065599900380068500100070072320171128140014.0 a20170831afrey50 ba0 bTESS aAménagement du territoire 31921565ga1 - CADRE ET MILIEU DE VIE 31856115haDéveloppement local 31861065haEquipement collectif 31861135haMilieu rural 31906215haAménagement foncier 31887235haDéveloppement régional 31911715haCoopération territoriale 31885705haZone touristique 31872935haZone d'aménagement du territoire 31909415haPôle de compétitivité 31854275haZone d'entreprises 31905315haOuvrage d'art 31889315haTerritoire 31853835haPolitique d'aménagement du territoire 31900005haCoopération transfrontalière 31900015haCoffee Machine 9tess:TESS/AMENAGEMENTDUTERRITOIRE18534900207 a2200097 450000500170000010000290001715200090004625000190005599900280007400100070010220171128140013.0 a20170831afrey50 ba0 bTESS aCoffee Machine 9tess:TESS/COFFEEMACHINE19000100413 a2200157 450000500170000010000290001715200090004625000270005555000330008255000190011555000210013455000310015555000310018699900310021700100070024820171128140004.0 a20170831afrey50 ba0 bTESS aAssurance des maladies 31877265gaAssurance sociale 31885535haCMU 31888975haCMU-C 3185350aSystème de santé 3185350aSystème de santé 9tess:TESS/ASSURANCEMALADIE18535100251 a2200109 450000500170000010000290001715200090004625000160005555000390007199900250011000100060013520171128140004.0 a20170831afrey50 ba0 bTESS aCoffee room 3185349aAménagement du territoire 9tess:TESS/COFFEEROOM20002 \ No newline at end of file