diff --git a/cosmogramme/php/classes/classe_unimarc.php b/cosmogramme/php/classes/classe_unimarc.php index 2424708076904833ca804bfb058e05df5856da6e..498c1bc850fab6b40885c6ddb26ba2ee31c63224 100644 --- a/cosmogramme/php/classes/classe_unimarc.php +++ b/cosmogramme/php/classes/classe_unimarc.php @@ -203,7 +203,7 @@ class notice_unimarc extends iso2709_record { { // type de doc $notice["type_doc"] = 100; - $notice["infos_type_doc"] = array("code"=>100,libelle=>"article de périodique"); + $notice["infos_type_doc"] = ["code"=>100, 'libelle'=>"article de périodique"]; // statut $notice["statut"] = $this->getStatut(); diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index 9a679cd3b9e2a5e6428280ec2d683e9bb0d1a535..d00feec099d5827e7249328b1cfda141f6907b96 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -2384,4 +2384,41 @@ class NoticeIntegrationSerialTopSanteTest extends NoticeIntegrationTestCase { public function noticeShouldHaveFiveArticles() { $this->assertCount(5, $this->notice->getArticlesPeriodique()); } -} \ No newline at end of file +} + + + +class NoticeIntegrationAloesSerialIndexpressBellesHistoireTest extends NoticeIntegrationTestCase { + public function getProfilDonnees() { + return Class_IntProfilDonnees::forALOES() + ->setIdProfil(111) + ->getRawAttributes(); + } + + + public function setUp() { + parent::setUp(); + + $contents = file_get_contents(dirname(__FILE__)."/unimarc_petit_doucet.txt"); + + array_map([$this, 'loadNoticeFromString'], + preg_split('/'.chr(30).chr(29).'/', $contents)); + + $this->notice = Class_Notice::find(1); + } + + + /** @test */ + public function mainTitleShouldBeBellesHistoires() { + $this->assertEquals('Belles histoires (Les)', $this->notice->getTitrePrincipal()); + } + + + /** @test */ + public function noArticleShouldHaveBeenSaved() { + $this->assertCount(0, Class_Notice_SerialArticles::findAll()); + } +} + + +?> \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/unimarc_petit_doucet.txt b/cosmogramme/tests/php/classes/unimarc_petit_doucet.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc11399aa4c080cf51861de2891951d1f1529767 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_petit_doucet.txt @@ -0,0 +1 @@ +00369nas0 2200097 450 0010008000001000041000082000044000494610036000934620093001299950049002220690665 a20150429a|||| uu y0frey0103 ba| aBelles histoires (Les)h509i01/05/2015 |30627457tBelles histoires (Les) 30690669tLe petit Doucet et les 7 filles de l'ogrefHistoire Âecrite par Arnaud AlmÂeras 30690666aBDYbYf16431346045kA ALM bqJruu00638naa0 2200181 450 0010008000001000041000081010008000491020007000572000113000642150010001773300159001876760006003467000037003527020023003898010028004129020010004409030006004500690669 a20150429a|||| u y0frey0103 ba| afre aFR| aLe petit Doucet et les 7 filles de l'ogrefHistoire Âecrite par Arnaud AlmÂerasgillustrÂee par Sara Ogilvie a42 p. aIl Âetait une fois un petit garÐcon et trÁes gentil... Un jour, ses six frÁeres trÁes moqueurs et trÁes mÂechants dÂecident de le perdre dans la forÃet... aA 1aAlmÂerasbArnaudf1967-....4070 1aOgilviebSara4440 1aFRbBDP YONNEc20150429 aAlbum ab \ No newline at end of file diff --git a/library/Class/Notice/SerialArticles.php b/library/Class/Notice/SerialArticles.php index 0f6c821d08b89f6038ecb5c6e61c85f61f51e86b..ebf55ba7833772c02b7950d7285b31a8fd70ac04 100644 --- a/library/Class/Notice/SerialArticles.php +++ b/library/Class/Notice/SerialArticles.php @@ -23,6 +23,21 @@ class Class_Notice_SerialArticles extends Storm_Model_Abstract { protected $_table_name = 'notices_articles', $_table_primary = 'id_article'; + + + protected $_default_attribute_values = ['clef_chapeau' => '', + 'clef_numero' => '', + 'clef_article' => '', + 'unimarc' => '']; + + + public function validate() { + if (!$this->getClefChapeau()) + $this->addError('Clé chapeau requise'); + + if (!$this->getClefNumero()) + $this->addError('Clé numero requise'); + } } ?> \ No newline at end of file