diff --git a/VERSIONS_HOTLINE/116443 b/VERSIONS_HOTLINE/116443 new file mode 100644 index 0000000000000000000000000000000000000000..4e552ae2168b8d7822733a2038ee52d1752398bf --- /dev/null +++ b/VERSIONS_HOTLINE/116443 @@ -0,0 +1 @@ + - ticket #116443 : Gestion des zones de notes à l'affichage \ No newline at end of file diff --git a/library/Class/Notice.php b/library/Class/Notice.php index c084c79e7e60eb33dc1a8ca9d6d37aa6ba34b901..713c8d67d87d8591d0e47cd663520500b1a1fd6e 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -1431,7 +1431,7 @@ class Class_Notice extends Storm_Model_Abstract { // ---------------------------------------------------------------- public function getNotes() { - $zones = array('300a', '303a', '304a', '305a', '306a', '307a', '308a', '310a', '312a', '313a', '314a', '316a', '317a', '320a', '321a', '323a', '334abcd', '337a', '345a'); + $zones = array('300a', '301a', '302a', '303a', '304a', '305a', '306a', '307a', '308a', '310a', '311a', '312a', '313a', '314a', '315a', '316a', '317a', '318a','320a', '321a','322a', '323a', '324a', '325a', '326a', '327a', '328a', '333a', '334abcd', '337a', '345a', '359a', '371a'); $notes = array(); foreach ($zones as $elem) @@ -1444,7 +1444,7 @@ class Class_Notice extends Storm_Model_Abstract { $mot = ''; foreach ($sous_champs as $item) { - if (strpos($champs, $item['code']) !== false) + if ($item['code'] && (strpos($champs, $item['code']) !== false)) { if ($mot) $mot.=', '; $mot.=$item['valeur']; diff --git a/tests/library/Class/DecodageUnimarcTest.php b/tests/library/Class/DecodageUnimarcTest.php index 5a474e0d5d716b2ec1d1b5a85de4627b8f3e3deb..61dbeacba830dfac88d69a8a850a13e732c8c005 100644 --- a/tests/library/Class/DecodageUnimarcTest.php +++ b/tests/library/Class/DecodageUnimarcTest.php @@ -482,4 +482,42 @@ class DecodageUnimarcVieDAdeleTest extends ModelTestCase { } } + + + + + +class DecodageUnimarcZoneNotesTest extends ModelTestCase { + public function getZoneToTest() { + return [['301'], + ['302'], + ['311'], + ['315'], + ['318'], + ['322'], + ['324'], + ['325'], + ['326'], + ['327'], + ['328'], + ['333'], + ['359'], + ['371']]; + } + + + /** @test + @dataProvider getZoneToTest + */ + public function zoneNoteShouldContainsMyBlueNote($field) { + $unimarc = (new Class_NoticeUnimarc_Fluent); + $unimarc->newZone()->label('200')->addChild('a', 'New title'); + $unimarc->newZone()->label($field)->addChild('a', 'My blue note'); + $this->fixture('Class_Notice', + ['id' => 142, + 'unimarc'=>$unimarc->render() + ])->save(); + $this->assertContains('My blue note', Class_Notice::find(142)->getNotes()); + } +} ?> \ No newline at end of file