diff --git a/VERSIONS_HOTLINE/153580 b/VERSIONS_HOTLINE/153580 new file mode 100644 index 0000000000000000000000000000000000000000..f0ecd99537be8168eb2dc823bc62f7950842bf0d --- /dev/null +++ b/VERSIONS_HOTLINE/153580 @@ -0,0 +1 @@ + - correctif #153580 : Facettes dynamiques sur zone 600/type rameau : si plusieurs identifiants, ne prends que le premier pour l'id_origine du thesaurus \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php b/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php index 06d1ba361d1dd5f1535f00c880ecf4250f57577a..596bf727f0f4382c153e5384b86d23722545e593 100644 --- a/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php +++ b/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php @@ -142,6 +142,42 @@ class KohaRecordIntegrationUnimarcWithoutLabelBlocTest extends KohaRecordIntegra +class KohaRecordIntegrationZone600RameauTest extends KohaRecordIntegrationTestCase { + public function setUp() { + parent::setUp(); + $this->fixture(Class_CodifThesaurus::class, + ['id' => 1, + 'libelle' => 'Sujet PERSONNE', + 'id_thesaurus' => 'SUJP', + 'id_origine' => null, + 'code' => 'SUJP', + 'rule_list_zone' => ['600'], + 'rule_list_label_field' => ['w'], + 'rule_list_label_start_pos' => [1], + 'rule_list_label_length' => [0], + 'rule_list_id_field' => ['9'] + ]); + + $this->loadNotice('unimarc_le_corbusier'); + } + + + /** @test */ + public function codifThesaurusWithIdOrigne345311LabelShouldBeLeCorbusier1887_1965() { + $this->assertEquals('Le Corbusier (1887-1965)', + Class_CodifThesaurus::findFirstBy(['id_origine' => 345311])->getLibelle()); + } + + + /** @test */ + public function numberOfCodifThesaurusShouldBeTwo() { + $this->assertEquals(2, Class_CodifThesaurus::countBy([])); + } +} + + + + class KohaRecordIntegrationFacetPresseTest extends KohaRecordIntegrationTestCase { public function getProfilDonnees() { return Class_IntProfilDonnees::forKoha() diff --git a/cosmogramme/tests/php/classes/unimarc_le_corbusier.txt b/cosmogramme/tests/php/classes/unimarc_le_corbusier.txt new file mode 100644 index 0000000000000000000000000000000000000000..39cf27f943121f218ea27692fcca87eee17ae144 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_le_corbusier.txt @@ -0,0 +1 @@ +02248cam0 2200481 4500001000700000003003000007005001700037009001000054010002200064035001400086035002100100035001100121090001100132098001500143099005000158100004100208101000800249102000700257105001800264106000600282181002500288181002000313182002100333182001100354200004100365210006600406215003800472320003200510330044000542452011800982600020001100600006201300610003501362676001501397680002601412700004201438801003001480801001401510801001701524930004901541991006301590995011301653145891http://www.sudoc.fr/12568524620220314182008.0125685246 a978-0-7506-6354-0 aMALQ45025 a(OCoLC)494195009 a145891 a145891 e2021-02-05 tLIVc2008-03-05s0e2021-12-07d2022-03-14x0 a20080704d2007 k y0frey50 ba aeng aNL aa a 001|y ar 6z01ctxt2rdacontent 16z01ai#bxxxe## 6z01cn2rdamedia 16z01an1 aLe Corbusier in detailfFlora Samuel aAmsterdamaBostonaLondoncElsevier/Architectural Pressd2007 a1 vol. (xvi, 232 p.)cill.d25 cm aBibliogr. p. 219-226. Index aL'auteure eÌtudie les deÌtails architecturaux des projets de Le Corbusier en les preÌsentant dans six sections theÌmatiques : standardisation et uniteÌ (structure, etc.), deÌtails somatiques (couleur, espace, sons, etc.) ombre et lumieÌ€re (vitres, brise-soleil, etc.), cadrage (vues, mobilier, etc.), eÌleÌments de la promenade architecturale (porte, escalier,etc ;), rituels (autels, foyers, gouttieÌ€res, etc.), nuages 1959. 0258909137tLe Corbusier in detailfFlora SamuelcAmsterdamnElsevier/Architectural Pressd2007y978-0-08-055062-6 030273046129345311aLe Corbusierf1887-196530291170549370010xCritique et interpreÌtationz20e sieÌ€cle2rameau9346666wLe Corbusier (1887-1965) -- Critique et interpreÌtation -- 20e sieÌ€cle 0aLe Corbusierf1887-19659345311wLe Corbusier (1887-1965) aMonographiexMonography959234 a720.92v22 aNA1053.J4bS27 2007eb 30744827859383421aSamuelbFlora4070 3aFRbAbesc20211206gAFNOR 0bNTgAACR2 2bYDXCPgAACR2 5774682305:685812502b774682305cARCaLECO 25 aExemplaire creÌeÌ en masse par ITEM. le 04-02-2021 17:24 002052013-06-179182716bMLVLcMLVLeARCfMLVL028948j19197kLECO 25m2016-03-08o0rLIVw2016-03-10a19197 \ No newline at end of file diff --git a/library/Class/NoticeUnimarc/ListFields.php b/library/Class/NoticeUnimarc/ListFields.php index 04de3dee74ec8ee849c1beecaccd8ae78bd0a837..299b851b235055340a71c1397362ede3609a0d03 100644 --- a/library/Class/NoticeUnimarc/ListFields.php +++ b/library/Class/NoticeUnimarc/ListFields.php @@ -26,6 +26,7 @@ class Class_NoticeUnimarc_ListFields { $_list_fields, $_list_result, $_zone, + $_field_id_code_cache, $_valid = false; public function __construct($rules_or_array, $zone = null) { @@ -59,29 +60,41 @@ class Class_NoticeUnimarc_ListFields { } - public function addCodeValue($code, $value) { + public function addCodeValue($code, $value) : self { if (!($working_list = $this->_getWorkingList($code))) return $this; - $with_value = $working_list->detect(function ($field) { + $previously_defined_value = $working_list->detect(function ($field) { return $field->getValue(); }); - if ($with_value) + if ($previously_defined_value && $this->_isFieldForId($code)) + return $this; + + if ($previously_defined_value) return $this->addInResultAndReset($code, $value); $working_list->eachDo(function ($field) use ($value) { $field->setValue($value); }); + return $this; } + protected function _isFieldForId($code) : bool { + if (!isset($this->_field_id_code_cache)) + $this->_field_id_code_cache = $this->_getFieldId()->getCode(); + + return $this->_field_id_code_cache == $code; + } + + public function addInResultAndReset($code = null, $value = null) { if ($this->_canAddResult()) $this->_list_result [] = $this->_buildOneResult(); - $this->_reset(); + $this->_reset(); $this->_addAfterReset($code, $value); return $this; } @@ -126,7 +139,7 @@ class Class_NoticeUnimarc_ListFields { return $this; $working_list->eachDo(function ($field) use ($value) { - $field->setValue($value); + $field->setValue($value); }); return $this; diff --git a/tests/library/ZendAfi/View/Helper/Abonne/ResumeTest.php b/tests/library/ZendAfi/View/Helper/Abonne/ResumeTest.php index 11db1116496bce44967663f779bc5f72e6cb9591..52524398ec18a1b9a7f808bf64c5dfa6b92440a9 100644 --- a/tests/library/ZendAfi/View/Helper/Abonne/ResumeTest.php +++ b/tests/library/ZendAfi/View/Helper/Abonne/ResumeTest.php @@ -31,7 +31,7 @@ class View_Helper_Abonne_ResumeAsAbonneSIGBTest extends ViewHelperTestCase { $emprunteur = Class_WebService_SIGB_Emprunteur::nullInstance(); $emprunteur ->empruntsAddAll([Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire()->setDateRetour('13/03/2011'), - Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire()->setDateRetour('13/03/2022')]); + Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire()->setDateRetour('13/03/2024')]); $user = Class_Users::newInstanceWithId(3, ['fiche_sigb' => ['fiche' => $emprunteur],