From efb05440db54e7bda3797c2f36980dbc8c03f7c9 Mon Sep 17 00:00:00 2001 From: Andreas Roussos Date: Tue, 16 Apr 2024 14:13:45 +0000 Subject: [PATCH] Bug 36603: copy the ISNI number over automatically When linking authorities with other authorities in UNIMARC instances it would be good if Koha automatically copied the contents of subfield 010$a [aka INTERNATIONAL STANDARD NAME IDENTIFIER (ISNI)] into the corresponding 5xx$o subfield (should such an ISNI number exist in the source record). This patch enables the enhancement outlined above. For more information, please see the offical IFLA UNIMARC Authorities Format Manual (online ed., 1.0.0, 2023), pp. 350, 363, 385. This is actually where we got this idea from ;-) Note #1: it only applies to the Personal Name, Corporate Body Name, and Family Name authority types. Note #2: the default MARC Authorities framework that ships with UNIMARC Koha instances does *not* include a subfield $o for fields 200 (Authorized Access Point - Personal Name), 210 (Authorized Access Point - Corporate Body Name), 220 (Authorized Access Point - Family Name). This is per the offical IFLA Manual, and effectively means we can push the ISNI number to the same array used for other subfields (@subfield_loop) without worrying about overwriting any previous value. Test plan: 0) Have a UNIMARC Koha test instance up and running. Then, carry out the following steps in the Staff interface. 1) Stage for import the sample MARC authority data attached to this Bug report (filename: sample-auths.mrc, contains one Personal, one Corporate Body, and one Family Name). Go to 'Cataloging > Stage records for import' and upload the file. Make sure you select 'Authority' in the 'Record type' dropdown menu. Leave all other settings untouched at their default values. Click the 'Stage for import' button. Then, import the staged records into your Catalog. Go to 'Cataloging > Manage staged records'. Click on the filename link in the second column. At the bottom of the page, confirm you can see all three authorities included in the .mrc you uploaded, then click on the button named 'Import this batch into the catalog'. 2) Enable the authority finder plugin for authority fields 500, 510 and 520. This can be done as follows: a) Go to 'Administration > Authority types' and click on 'Actions->MARC structure' for the 'NP' (Personal Name) authority type. b) Search for tag 500; then click on 'Actions->Subfields' for that tag. c) Click 'Edit' next to subfield 'a' (Entry element), then pick 'NP' from the 'Thesaurus' dropdown menu. Save your settings and you're good to go! When editing a Personal Name authority from now on, the 'Tag editor' button next to subfield 500$a will launch the authority finder. Repeat b) and c): search for tag 510, edit $a, pick 'CO'. Repeat b) and c): search for tag 520, edit $a, pick 'FAM'. 3) Go to Koha's 'Authorities' module. At the top search bar, filter on Personal Name authorities and perform a search. Pick any one of the results, and edit it. Go to tab '5', expand field 500 and use the button next to subfield $a to launch the authority finder. Type '0000' inside the 'Search entire record:' text box, and click on 'Search', then 'Choose'. Notice that the ISNI number from the source record did *not* get copied to subfield 500$o. The same will happen if you try to Choose an authority for field 510 and 520. 4) Apply this patch. 5) Repeat step 3), this time the ISNI number from the source record will be copied to 500/510/520 $o automatically! Signed-off-by: David Nind --- authorities/blinddetail-biblio-search.pl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index 1dae908f35..91bc1dd6ee 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -96,6 +96,29 @@ if ($authid) { push( @subfield_loop, { marc_subfield => 'w', marc_values => $relationship } ) if ( $relationship ); + # Copy the ISNI number over (should one exist) to subfield $o when linking + # authorities with authorities in UNIMARC instances. This only applies to + # the Personal Name, Corporate Body Name, and Family Name authority types. + # + # It's worth noting that the default MARC Authorities framework that ships + # with UNIMARC Koha instances does *not* include a subfield $o for fields + # 200 (Authorized Access Point - Personal Name), + # 210 (Authorized Access Point - Corporate Body Name), and + # 220 (Authorized Access Point - Family Name). + # This is per the offical IFLA Manual, and effectively means we can save + # the ISNI number in the @subfield_loop array without worrying about + # overwriting any previous value that may exist. + # + # For more information, see the offical IFLA UNIMARC Authorities Format + # Manual (online ed., 1.0.0, 2023), pp. 350, 363, 385. + if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { + my $isnifield = $record->field('010'); + my $isnisubfield = $isnifield->subfield('a') if defined $isnifield; + my $isninumber = $isnisubfield + if defined $isnisubfield && ( $auth_type->auth_tag_to_report =~ /^(200|210|220)$/ ); + push( @subfield_loop, { marc_subfield => 'o', marc_values => $isninumber } ) if defined $isninumber; + } + my $controlled_ind = $auth->controlled_indicators({ record => $record, biblio_tag => $tag_number }); $indicator1 = $controlled_ind->{ind1}; $indicator2 = $controlled_ind->{ind2}; -- 2.39.2