From fe800ac81ff2bfddedd987aba420897660ffb45b Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@afi-sa.fr> Date: Thu, 18 Mar 2021 19:05:13 +0100 Subject: [PATCH] dev#126060 : export EAD add processinfo --- VERSIONS_WIP/126060 | 1 + library/Class/Album.php | 2 +- library/Class/AlbumCategorie/EadGallicaVisitor.php | 8 ++++++++ library/Class/AlbumCategorie/EadVisitor.php | 11 ++++++++--- .../AlbumControllerExportEadGallicaTest.php | 11 +++++++++++ 5 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 VERSIONS_WIP/126060 diff --git a/VERSIONS_WIP/126060 b/VERSIONS_WIP/126060 new file mode 100644 index 00000000000..17db2998413 --- /dev/null +++ b/VERSIONS_WIP/126060 @@ -0,0 +1 @@ + - ticket #126060 : Export EAD Gallica : ajout de l'export des identifiants de notices dans la balise processinfo \ No newline at end of file diff --git a/library/Class/Album.php b/library/Class/Album.php index 259af635923..b31732f863d 100644 --- a/library/Class/Album.php +++ b/library/Class/Album.php @@ -1523,7 +1523,7 @@ class Class_Album extends Storm_Model_Abstract { public function acceptEadVisitor($visitor) { foreach($this->getRessources() as $index => $ressource) $visitor->visitRessource($ressource, $index); - + $visitor->visitProcessInfo($this); Class_AlbumRessource::clearCache(); } diff --git a/library/Class/AlbumCategorie/EadGallicaVisitor.php b/library/Class/AlbumCategorie/EadGallicaVisitor.php index d1599602586..65674b97da1 100644 --- a/library/Class/AlbumCategorie/EadGallicaVisitor.php +++ b/library/Class/AlbumCategorie/EadGallicaVisitor.php @@ -79,6 +79,14 @@ class Class_AlbumCategorie_EadGallicaVisitor extends Class_AlbumCategorie_EadVis } + public function visitProcessInfo($album) { + if ($notice = $album->getNotice()) + return $this->_xml_content .= $this->_builder->processinfo(['audience' => 'internal'], + $this->_builder->p($notice->getId())); + return ''; + } + + public function visitPhysdesc($album) { $tab_physdesc = array_filter([$album->getDuration(), $album->getMisc(), diff --git a/library/Class/AlbumCategorie/EadVisitor.php b/library/Class/AlbumCategorie/EadVisitor.php index 0e340c0e7fa..3231658fef9 100644 --- a/library/Class/AlbumCategorie/EadVisitor.php +++ b/library/Class/AlbumCategorie/EadVisitor.php @@ -58,9 +58,9 @@ class Class_AlbumCategorie_EadVisitor { public function visitAlbum($album) { $this->_xml_content .= '<c01 id="' - . $album->getIdEad() - . '" level="file">' - . $this->_constructDid($album); + . $album->getIdEad() + . '" level="file">' + . $this->_constructDid($album); $album->acceptEadVisitor($this); @@ -203,4 +203,9 @@ class Class_AlbumCategorie_EadVisitor { ? $this->_builder->$tag($this->_builder->cdata($value)) : ''; } + + + public function visitProcessInfo($album) { + return ''; + } } \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AlbumControllerExportEadGallicaTest.php b/tests/application/modules/admin/controllers/AlbumControllerExportEadGallicaTest.php index 438502be38a..193156449d4 100644 --- a/tests/application/modules/admin/controllers/AlbumControllerExportEadGallicaTest.php +++ b/tests/application/modules/admin/controllers/AlbumControllerExportEadGallicaTest.php @@ -588,6 +588,7 @@ class Admin_AlbumControllerExportEadGallicaAlbumWithRecordFRBRTest ->setNotes(''); $album->assertSave(); + $album->index(); $album_absolute_url = Class_Url::absolute(array_merge(['id' => $album->getId()], $album->getPermalink()), @@ -711,4 +712,14 @@ class Admin_AlbumControllerExportEadGallicaAlbumWithRecordFRBRTest '//ead:archdesc/ead:dsc//ead:custodhist/ead:p', 'Dom Camillo, sept. 88'); } + + + /** @test */ + public function xmlShouldContainsNoticeIdInProcessInfo() { + $this->_xpath->assertXpathContentContains($this->_xml, + '//ead:c[@level="item"]//ead:processinfo[@audience="internal"]/ead:p', + '12388'); + } + + } \ No newline at end of file -- GitLab