Bug 39415

Summary: Add subfield g to Geographic name authority fields
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: MARC Authority data supportAssignee: Nick Clemens (kidclamp) <nick>
Status: Pushed to stable --- QA Contact: Matt Blenkinsop <matt.blenkinsop>
Severity: normal    
Priority: P5 - low CC: domm, esther.melander, matt.blenkinsop, paul.derscheid, phil
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.05.00,24.11.05
Circulation function:
Attachments: Bug 39415: Add subfield g for geographic name authorities
Bug 39415: Add subfield g for geographic name authorities
Bug 39415: Add subfield g for geographic name authorities
Bug 39415: (follow-up) Add 651g to bib heading fields as well
Bug 39415: Add subfield g for geographic name authorities
Bug 39415: (follow-up) Add 651g to bib heading fields as well
Bug 39415: Add subfield g for geographic name authorities
Bug 39415: (follow-up) Add 651g to bib heading fields as well

Description Nick Clemens (kidclamp) 2025-03-21 17:35:02 UTC
Subfield g is a valid subfield - we should respect it if present:

https://www.loc.gov/marc/authority/adx51.html
https://www.loc.gov/marc/authority/ad151.html
Comment 1 Nick Clemens (kidclamp) 2025-03-21 17:38:07 UTC
Created attachment 179629 [details] [review]
Bug 39415: Add subfield g for geographic name authorities

This patch adds the subfield g to the hardcoded list of controlled fields
so that it is no longer ignored

To test:
1 - Edit a GEOGR_NAME authority to add a g subfield to field 151
2 - Search for this authority in Authorities
3 - Don't see g
4 - Apply patch, restart all
5 - Search again, you see g!
6 - Edit a record and link to the authority
7 - g is copied over!
Comment 2 Phil Ringnalda 2025-03-21 20:29:19 UTC
Is the way that at step 6 the only way an authority will be linked is by looking it up from the cataloging editor, and that automatic linking from either  AutoLinkBiblios or the Link authorities automatically button will not work, the intended behavior?
Comment 3 Nick Clemens (kidclamp) 2025-03-31 13:46:41 UTC
(In reply to Phil Ringnalda from comment #2)
> Is the way that at step 6 the only way an authority will be linked is by
> looking it up from the cataloging editor, and that automatic linking from
> either  AutoLinkBiblios or the Link authorities automatically button will
> not work, the intended behavior?

No, it should work on all the methods, this was just a simple explanation for the test plan
Comment 4 Caroline Cyr La Rose 2025-04-01 13:36:32 UTC
Created attachment 180191 [details] [review]
Bug 39415: Add subfield g for geographic name authorities

This patch adds the subfield g to the hardcoded list of controlled fields
so that it is no longer ignored

To test:
1 - Edit a GEOGR_NAME authority to add a g subfield to field 151
2 - Search for this authority in Authorities
3 - Don't see g
4 - Apply patch, restart all
5 - Search again, you see g!
6 - Edit a record and link to the authority
7 - g is copied over!

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 5 Thomas Klausner 2025-04-02 13:23:35 UTC
Created attachment 180350 [details] [review]
Bug 39415: Add subfield g for geographic name authorities

This patch adds the subfield g to the hardcoded list of controlled fields
so that it is no longer ignored

To test:
1 - Edit a GEOGR_NAME authority to add a g subfield to field 151
2 - Search for this authority in Authorities
3 - Don't see g
4 - Apply patch, restart all
5 - Search again, you see g!
6 - Edit a record and link to the authority
7 - g is copied over!

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Comment 6 Thomas Klausner 2025-04-02 13:25:43 UTC
works! and nice, we recently had some problems with 151g not properly showing up, thanks
Comment 7 Phil Ringnalda 2025-04-03 03:37:21 UTC
Test plan which fails:
1. Set the prefs AutoLinkBiblios and CatalogModuleRelink to Do
2. Create three GEOGR_NAME authorities, 151$aDismal Swamp and 151$aDismal Swamp$gSouth and 151$aPit of Despair
3. In a new bib record, type Pit of Despair in 651 a and either Save and continue editing or Link authorities automatically. In either case, you should see the bib heading linked to the authority, which tells you linking is working
4. In a duplicate 651 field, type Dismal Swamp in a, and in another duplicate 651 field type Dismal Swamp in a and South in g
5. Again, Save and continue editing or Link authorities automatically

You would expect to have Dismal Swamp linked to the Dismal Swamp authority, and Dismal Swamp -- South linked to that authority, but instead you have both linked to the same Dismal Swamp authority.

The patch adds g to $bib_heading_fields in '151' which doesn't actually exist as a bib field, and not to '651' which does. I'd just add a follow-up patch to add it to 651, which makes my test plan succeed, but I'm not sure whether the 1xx things in $bib_heading_fields which do not exist are still required for something and have to be kept in sync with the 6xx ones, or if they should just be removed.
Comment 8 Nick Clemens (kidclamp) 2025-04-09 11:25:37 UTC
Created attachment 180740 [details] [review]
Bug 39415: (follow-up) Add 651g to bib heading fields as well

Test plan:
 0 - Apply other patches - reindex your catalog
     perl misc/search_tools/rebuild_elasticsearch.pl -v -d
 1 - Set the prefs AutoLinkBiblios and CatalogModuleRelink to Do
 2 - Create three GEOGR_NAME authorities:
      151$aDismal Swamp
      151$aDismal Swamp$gSouth
      151$aPit of Despair
 3 - In a new bib record, add 651 fields
      651$aPit of Despair
      651$aDismal Swamp
      651$aDismal Swamp$gSouth
 4 - Click Link authorities automatically
 5 - 'Pit of despair' links correct - other records both link to 'Dismal swamp'
 6 - Apply this patch, restart_all
 7 - Click Link authorities automatically
 8 - Dismal Swamp and Dismal Swamp South are correctly linked
Comment 9 Phil Ringnalda 2025-04-10 22:29:12 UTC
Created attachment 180803 [details] [review]
Bug 39415: Add subfield g for geographic name authorities

This patch adds the subfield g to the hardcoded list of controlled fields
so that it is no longer ignored

To test:
1 - Edit a GEOGR_NAME authority to add a g subfield to field 151
2 - Search for this authority in Authorities
3 - Don't see g
4 - Apply patch, restart all
5 - Search again, you see g!
6 - Edit a record and link to the authority
7 - g is copied over!

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Comment 10 Phil Ringnalda 2025-04-10 22:30:04 UTC
Created attachment 180804 [details] [review]
Bug 39415: (follow-up) Add 651g to bib heading fields as well

Test plan:
 0 - Apply other patches - reindex your catalog
     perl misc/search_tools/rebuild_elasticsearch.pl -v -d
 1 - Set the prefs AutoLinkBiblios and CatalogModuleRelink to Do
 2 - Create three GEOGR_NAME authorities:
      151$aDismal Swamp
      151$aDismal Swamp$gSouth
      151$aPit of Despair
 3 - In a new bib record, add 651 fields
      651$aPit of Despair
      651$aDismal Swamp
      651$aDismal Swamp$gSouth
 4 - Click Link authorities automatically
 5 - 'Pit of despair' links correct - other records both link to 'Dismal swamp'
 6 - Apply this patch, restart_all
 7 - Click Link authorities automatically
 8 - Dismal Swamp and Dismal Swamp South are correctly linked

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Comment 11 Matt Blenkinsop 2025-05-02 08:47:43 UTC
Created attachment 181847 [details] [review]
Bug 39415: Add subfield g for geographic name authorities

This patch adds the subfield g to the hardcoded list of controlled fields
so that it is no longer ignored

To test:
1 - Edit a GEOGR_NAME authority to add a g subfield to field 151
2 - Search for this authority in Authorities
3 - Don't see g
4 - Apply patch, restart all
5 - Search again, you see g!
6 - Edit a record and link to the authority
7 - g is copied over!

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Comment 12 Matt Blenkinsop 2025-05-02 08:47:46 UTC
Created attachment 181848 [details] [review]
Bug 39415: (follow-up) Add 651g to bib heading fields as well

Test plan:
 0 - Apply other patches - reindex your catalog
     perl misc/search_tools/rebuild_elasticsearch.pl -v -d
 1 - Set the prefs AutoLinkBiblios and CatalogModuleRelink to Do
 2 - Create three GEOGR_NAME authorities:
      151$aDismal Swamp
      151$aDismal Swamp$gSouth
      151$aPit of Despair
 3 - In a new bib record, add 651 fields
      651$aPit of Despair
      651$aDismal Swamp
      651$aDismal Swamp$gSouth
 4 - Click Link authorities automatically
 5 - 'Pit of despair' links correct - other records both link to 'Dismal swamp'
 6 - Apply this patch, restart_all
 7 - Click Link authorities automatically
 8 - Dismal Swamp and Dismal Swamp South are correctly linked

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Comment 13 Katrin Fischer 2025-05-06 16:54:01 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 14 Paul Derscheid 2025-05-26 18:18:02 UTC
Nice work everyone!

Pushed to 24.11.x for 24.11.05