Bug 36603

Summary: UNIMARC: automatically copy the ISNI number over when linking authorities with authorities
Product: Koha Reporter: Andreas Roussos <a.roussos>
Component: MARC Authority data supportAssignee: Andreas Roussos <a.roussos>
Status: Passed QA --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: david, julian.maurice, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enables the automatic copying over of authority subfield 010$a [aka INTERNATIONAL STANDARD NAME IDENTIFIER (ISNI)] into the corresponding 5xx$o subfield when linking authorities with other authorities in UNIMARC instances. It only applies to the Personal Name, Corporate Body Name, and Family Name authority types.
Version(s) released in:
Circulation function:
Attachments: Sample MARC data in ISO2709 format (contains three authority records)
Bug 36603: copy the ISNI number over automatically
Bug 36603: copy the ISNI number over automatically
Bug 36603: copy the ISNI number over automatically
Bug 36603: (QA follow-up) Resolve two conditional declarations

Description Andreas Roussos 2024-04-15 15:23:41 UTC
The 2023 edition of the IFLA UNIMARC Authorities Format Manual [1]
has the following to say about subfield $o of authority fields 500,
510 and 520 [2,3,4]:

"$o International Standard Name Identifier (ISNI)
The subfield $o (International Standard Name Identifier) is used
in field 510 to record the ISNI of the related identity. When the
preferred access point of an authority record that contains field 010
is transferred to the 500/510/520 access point of another record
(while establishing a link between both authority records),
the number contained in the 010 field of the first record
will also be transferred in a devoted subfield $o. Repeatable."

So, when linking authorities with other authorities in UNIMARC
instances I think it would be a good idea if Koha automatically
copied the contents of subfield 010$a [5] into the corresponding
5xx$o subfield (if such an ISNI number exists in the source record,
of course).

[1] https://repository.ifla.org/handle/123456789/3011
[2] 500 RELATED ACCESS POINT – PERSONAL NAME
[3] 510 RELATED ACCESS POINT – CORPORATE BODY NAME
[4] 520 RELATED ACCESS POINT – FAMILY NAME
[5] 010 INTERNATIONAL STANDARD NAME IDENTIFIER (ISNI)
Comment 1 Andreas Roussos 2024-04-16 14:44:39 UTC
Created attachment 164950 [details]
Sample MARC data in ISO2709 format (contains three authority records)

I'm uploading this sample file because I want to use it in the Test plan.
It's not so easy to just edit an authority and add an ISNI number because
of the many mandatory subfields involved.
Comment 2 Andreas Roussos 2024-04-16 14:46:11 UTC
Created attachment 164952 [details] [review]
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!
Comment 3 David Nind 2024-05-25 00:08:49 UTC
Created attachment 167178 [details] [review]
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 <david@davidnind.com>
Comment 4 David Nind 2024-05-25 00:14:03 UTC
Thank you for the very clear and step-by-step test plan, as well as the sample records. This made it very easy to test!

Testing notes (using KTD):
1. To start up KTD as a UNIMARC instance, edit your KTD .env file and change KOHA_MARC_FLAVOUR=unimarc
Comment 5 Marcel de Rooy 2024-11-01 10:23:49 UTC
Created attachment 173861 [details] [review]
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 <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Marcel de Rooy 2024-11-01 10:23:51 UTC
Created attachment 173862 [details] [review]
Bug 36603: (QA follow-up) Resolve two conditional declarations

QA tools reported:
 FAIL   authorities/blinddetail-biblio-search.pl
   FAIL   critic
                # Variables::ProhibitConditionalDeclarations: Got 2 violation(s).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Marcel de Rooy 2024-11-01 10:24:39 UTC
Julian: still care to take a quick look at this UNIMARC patch ?