Commit ee9a42e7 authored by Laurent's avatar Laurent

hotline #94707 fix EAD export

parent 453ffdcd
Pipeline #7686 failed with stage
in 31 minutes and 32 seconds
- ticket #94707 : correction de l'export EAD
\ No newline at end of file
......@@ -123,18 +123,24 @@ class ZendAfi_View_Helper_Album_ExportEadVisitor extends Zend_View_Helper_Abstr
$b = $this->_builder;
$matieres = explode(';', $matieres_str);
foreach ($matieres as $matiere_id) {
$matiere = Class_Matiere::find($matiere_id);
if (!$matiere)
continue;
$controlaccess .= $b->controlaccess($b->subject($b->cdata($matiere->getLibelle()))
. $b->title($b->cdata($album->getTitre()))
. $b->persname($b->cdata($album->getAuteur())));
}
return $controlaccess;
$authors = implode('',
array_map(
function($author) use ($b) {
return $b->persname($b->cdata($author));
},
$album->getAuthorsNames()));
$subjects = implode('',
array_map(
function($matiere) use ($b) {
return $b->subject($b->cdata($matiere->getLibelle()));
},
Class_Matiere::findAllBy(['id_matiere' => explode(';', $matieres_str)])));
return $b->controlaccess($subjects
. $b->title($b->cdata($album->getTitre()))
. $authors);
}
......
......@@ -1479,7 +1479,6 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerEditA
}
/** @test */
function formShouldHaveTagSuggestForMatiere() {
$this->assertXPath("//input[@name='matiere'][@value='1;3;5']");
......@@ -2903,11 +2902,13 @@ abstract class ControllerAlbumMultiMediasTestCase extends Admin_AlbumControllerT
->setIdOrigine("A888")
->setCote('50')
->setDateMaj('2012-02-17 10:00:00')
->setMatiere('1;3')
->setNotes(['305$a' => 'XXe siècle',
'200$b' => 'Parchemin',
'316$a' => 'Reliure restaurée en 1980 par la BN.'])
->setIdLang('lat')
->addAuthor('Titi')
->addAuthor('Grominet')
->setRessources([Class_AlbumRessource::newInstanceWithId(2)
->setFichier('mimi_jolie.mp3')
->setTitre('Emilie jolie')
......@@ -2936,6 +2937,15 @@ abstract class ControllerAlbumMultiMediasTestCase extends Admin_AlbumControllerT
->assertSave();
$this->fixture('Class_Matiere',
['id' => 1,
'libelle' => 'jeux']);
$this->fixture('Class_Matiere',
['id' => 3,
'libelle' => 'escargots']);
$this->fixture('Class_AlbumCategorie',
['id' => '33',
'libelle' => 'Comics',
......@@ -3027,6 +3037,30 @@ class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTest
}
/** @test */
public function documentShouldContainsPersnameTiti() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//ead:controlaccess//ead:persname',
'Titi');
}
/** @test */
public function documentShouldContainsPersnameGrominet() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//ead:controlaccess//ead:persname',
'Grominet');
}
/** @test */
public function documentShouldContainsSubjectEscargot() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//ead:controlaccess//ead:subject',
'escargots');
}
/** @test */
public function c02TitleShouldBeR2() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment