From e7c6dbef4e98ef7322846be6222f88fa25f60c7d Mon Sep 17 00:00:00 2001 From: Megan Schanz Date: Thu, 10 Oct 2024 11:13:20 -0400 Subject: [PATCH] Add additional 520 fields to record description tab --- languages/en.ini | 2 ++ languages/fr.ini | 2 ++ .../Feature/MarcAdvancedTrait.php | 20 +++++++++++++ .../Root/RecordDataFormatterFactory.php | 2 ++ .../Feature/MarcAdvancedTraitTest.php | 30 +++++++++++++++++++ 5 files changed, 56 insertions(+) diff --git a/languages/en.ini b/languages/en.ini index 449e4008104..07b7b296bf2 100644 --- a/languages/en.ini +++ b/languages/en.ini @@ -281,6 +281,7 @@ confirm_storage_retrieval_request_cancel_selected_text = "Do you wish to cancel Connecting of library cards is not supported = "Connecting of library cards is not supported" consortial_vufind_recommend_heading = "Borrow from a Partner Library" consortial_vufind_recommend_intro_html = '%%result_count%% result(s) found at partner libraries.' +Content Advice = "Content Advice" Contents = "Contents" Contributing Source = "Contributing Source" Contributors = "Contributors" @@ -1249,6 +1250,7 @@ results_citing_title_search_link = "Items that cite this one" Resumption Token = "Resumption Token" Return Date = "Return Date" Review by = "Review by" +Review Notes = "Review Notes" Reviews = "Reviews" Save = "Save" Save Comment = "Save Comment" diff --git a/languages/fr.ini b/languages/fr.ini index 6d4d0e1f956..b950a6f8830 100644 --- a/languages/fr.ini +++ b/languages/fr.ini @@ -273,6 +273,7 @@ confirm_renew_selected_text = "Voulez-vous prolonger les emprunts sélectionnés confirm_storage_retrieval_request_cancel_all_text = "Voulez-vous annuler toutes vos demandes de communication en magasin ?" confirm_storage_retrieval_request_cancel_selected_text = "Voulez-vous annuler les demandes de communication en magasin sélectionnées ?" Connecting of library cards is not supported = "Il n'est pas possible de connecter une carte de bibliothèque." +Content Advice = "Note de Contenu" Contents = "Contenu" Contributing Source = "Sources" Contributors = "autres auteurs" @@ -1166,6 +1167,7 @@ Results per page = "Résultats par page" Resumption Token = "Jeton (Resumption Token)" Return Date = "Date de retour" Review by = "Recension de" +Review Notes = "Notes de Révision" Reviews = "Recensions" Save = "Sauvegarder" Save Comment = "Sauvegarder le commentaire" diff --git a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php index 30c2e32e696..0c198cc14f3 100644 --- a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php +++ b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php @@ -1286,4 +1286,24 @@ public function getAbstractNotes() { return $this->getMarcFieldWithInd('520', range('a', 'z'), [[1 => ['3']]]); } + + /** + * Get the review notes + * + * @return array Note fields from the MARC record + */ + public function getReviewNotes() + { + return $this->getMarcFieldWithInd('520', range('a', 'z'), [[1 => ['1']]]); + } + + /** + * Get the content advice notes + * + * @return array Note fields from the MARC record + */ + public function getContentAdviceNotes() + { + return $this->getMarcFieldWithInd('520', range('a', 'z'), [[1 => ['4']]]); + } } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatterFactory.php b/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatterFactory.php index 2f99346c99e..5911d661bf6 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatterFactory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatterFactory.php @@ -372,6 +372,8 @@ public function getDefaultDescriptionSpecs() $spec = new RecordDataFormatter\SpecBuilder(); $spec->setTemplateLine('Summary', true, 'data-summary.phtml'); $spec->setLine('Abstract', 'getAbstractNotes'); + $spec->setLine('Review Notes', 'getReviewNotes'); + $spec->setLine('Content Advice', 'getContentAdviceNotes'); $spec->setLine('Published', 'getDateSpan'); $spec->setLine('Item Description', 'getGeneralNotes'); $spec->setLine('Physical Description', 'getPhysicalDescriptions'); diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/Feature/MarcAdvancedTraitTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/Feature/MarcAdvancedTraitTest.php index 0abd637b9ba..d27baca966e 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/Feature/MarcAdvancedTraitTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/Feature/MarcAdvancedTraitTest.php @@ -332,6 +332,36 @@ public function testGetAbstractNotes(): void ); } + /** + * Test calling getReviewtNotes to get expected marc data + * + * @return void + */ + public function testGetReviewNotes(): void + { + $obj = $this->getMockDriverFromFixture('marc/marctraits.xml'); + + $this->assertEquals( + ['Review Note. Expanded.'], + $obj->getReviewNotes() + ); + } + + /** + * Test calling getContentAdviceNotes to get expected marc data + * + * @return void + */ + public function testGetContentAdviceNotes(): void + { + $obj = $this->getMockDriverFromFixture('marc/marctraits.xml'); + + $this->assertEquals( + ['Content Advice. Expanded.'], + $obj->getContentAdviceNotes() + ); + } + /** * Test calling getLocationOfArchivalMaterialsNotes to get expected marc data *