Bug 24421

Summary: Generated authorities are missing subfields
Product: Koha Reporter: Nick Clemens <nick>
Component: MARC Authority data supportAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: critical    
Priority: P5 - low CC: 1joynelson, aspencatteam, gveranis, hayleypelham, jonathan.druart, lucas, mkstephens
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.03, 19.05.08
Bug Depends on: 21826    
Bug Blocks: 24269    
Attachments: Bug 24421: Check if subfields are valid using the biblio tag
Bug 24421: Check if subfields are valid using the biblio tag
Bug 24421: Unit tests
Bug 24421: Check if subfields are valid using the biblio tag
Bug 24421: Unit tests
Bug 24421: Check if subfields are valid using the biblio tag

Description Nick Clemens 2020-01-14 16:07:43 UTC
In bug 21826 the intent was to only add allowed subfields to generated authorities, however, the code uses the authority tag instead of the biblio tag - there is no mapping for these, so correct subfields are ignored

To recreate:
1 - Enable the sysprefs
     AutoCreateAuthorities 
     BiblioAddsAuthorities
     CatalogModuleRelink
2 - Open a record with a subject heading with a subdivision and add a new subfield, or add a new unauthroized heading to a record and save it
    e.g. 650$aChess$xOpenings$vFiction.
3 - Save the record, note the created authority and that field is linked
4 - Save the record again and note the authority number changes
5 - Find and view the authority linked to the record
6 - The record is for 'Chess', not Chess openings'
7 - Search authorities for 'Chess' - note duplicated records
Comment 1 Nick Clemens 2020-01-14 16:16:36 UTC
Created attachment 97358 [details] [review]
Bug 24421: Check if subfields are valid using the biblio tag

To test:
 1 - Enable the sysprefs
     AutoCreateAuthorities
     BiblioAddsAuthorities
     CatalogModuleRelink
 2 - Open a record with a subject heading with a subdivision and add a new subfield, or add a new unauthroized heading to a record and save it
    e.g. 650$aChess$xOpenings$vFiction.
 3 - Save the record, note the created authority and that field is linked
 4 - Save the record again and note the authority number changes
 5 - Find and view the authority linked to the record
 6 - The record is for 'Chess', not Chess openings'
 7 - Search authorities for 'Chess' - note duplicated records
 8 - Apply patch, restart all
 9 - Save the record, auth number increases again, we shoudl create the correct record this time
10 - Save again, auth number should not change
11 - Search authorities and confirm the generated authority has the correct subfields
Comment 2 Nick Clemens 2020-01-14 16:17:57 UTC
In certain instances this can cause nearly the entire catalog to be relinked to new authorities and generate many duplicated records - marking as critical
Comment 3 Myka Kennedy Stephens 2020-01-18 22:56:45 UTC
Created attachment 97583 [details] [review]
Bug 24421: Check if subfields are valid using the biblio tag

To test:
 1 - Enable the sysprefs
     AutoCreateAuthorities
     BiblioAddsAuthorities
     CatalogModuleRelink
 2 - Open a record with a subject heading with a subdivision and add a new subfield, or add a new unauthroized heading to a record and save it
    e.g. 650$aChess$xOpenings$vFiction.
 3 - Save the record, note the created authority and that field is linked
 4 - Save the record again and note the authority number changes
 5 - Find and view the authority linked to the record
 6 - The record is for 'Chess', not Chess openings'
 7 - Search authorities for 'Chess' - note duplicated records
 8 - Apply patch, restart all
 9 - Save the record, auth number increases again, we shoudl create the correct record this time
10 - Save again, auth number should not change
11 - Search authorities and confirm the generated authority has the correct subfields

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Comment 4 Myka Kennedy Stephens 2020-01-18 22:57:13 UTC
Patch works as expected. Thank you!
Comment 5 Jonathan Druart 2020-01-21 15:21:59 UTC
Nick, can you cover the change with tests please?
Comment 6 Nick Clemens 2020-01-24 13:44:17 UTC
Created attachment 97881 [details] [review]
Bug 24421: Unit tests
Comment 7 Nick Clemens 2020-01-24 13:44:20 UTC
Created attachment 97882 [details] [review]
Bug 24421: Check if subfields are valid using the biblio tag

To test:
 1 - Enable the sysprefs
     AutoCreateAuthorities
     BiblioAddsAuthorities
     CatalogModuleRelink
 2 - Open a record with a subject heading with a subdivision and add a new subfield, or add a new unauthroized heading to a record and save it
    e.g. 650$aChess$xOpenings$vFiction.
 3 - Save the record, note the created authority and that field is linked
 4 - Save the record again and note the authority number changes
 5 - Find and view the authority linked to the record
 6 - The record is for 'Chess', not Chess openings'
 7 - Search authorities for 'Chess' - note duplicated records
 8 - Apply patch, restart all
 9 - Save the record, auth number increases again, we shoudl create the correct record this time
10 - Save again, auth number should not change
11 - Search authorities and confirm the generated authority has the correct subfields

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Comment 8 Jonathan Druart 2020-01-27 10:43:08 UTC
Coming from
  commit b2b7d376d4854394322310f28d2f5aa1560384e0
  Bug 21826: Use subfield map in LinkBibHeadingsToAuthorities
Comment 9 Jonathan Druart 2020-01-27 10:43:53 UTC
Created attachment 97968 [details] [review]
Bug 24421: Unit tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Jonathan Druart 2020-01-27 10:43:56 UTC
Created attachment 97969 [details] [review]
Bug 24421: Check if subfields are valid using the biblio tag

To test:
 1 - Enable the sysprefs
     AutoCreateAuthorities
     BiblioAddsAuthorities
     CatalogModuleRelink
 2 - Open a record with a subject heading with a subdivision and add a new subfield, or add a new unauthroized heading to a record and save it
    e.g. 650$aChess$xOpenings$vFiction.
 3 - Save the record, note the created authority and that field is linked
 4 - Save the record again and note the authority number changes
 5 - Find and view the authority linked to the record
 6 - The record is for 'Chess', not Chess openings'
 7 - Search authorities for 'Chess' - note duplicated records
 8 - Apply patch, restart all
 9 - Save the record, auth number increases again, we shoudl create the correct record this time
10 - Save again, auth number should not change
11 - Search authorities and confirm the generated authority has the correct subfields

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Martin Renvoize 2020-01-27 16:00:09 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 12 Joy Nelson 2020-01-31 00:42:20 UTC
Pushed to 19.11.x branch for 19.11.03
Comment 13 Lucas Gass 2020-02-06 17:01:56 UTC
backported to 19.05.x for 19.05.08
Comment 14 Hayley Pelham 2020-02-20 21:52:23 UTC
Depends on code not in 18.11.x, not backporting
Comment 15 Phil Ringnalda 2024-02-23 19:03:35 UTC
*** Bug 23532 has been marked as a duplicate of this bug. ***