Bug 27577

Summary: Autolink bibs after generating the biblionumber
Product: Koha Reporter: Nick Clemens <nick>
Component: CatalogingAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrewfh, dcook, fridolin.somers, jonathan.druart, kyle, m.de.rooy, phil, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12
Attachments: Bug 27577: Autolink biblio after biblionumber is generated
Bug 27577: Autolink biblio after biblionumber is generated
Bug 27577: Autolink biblio after biblionumber is generated
Bug 27577: Unit test
Bug 27577: Autolink biblio after biblionumber is generated

Description Nick Clemens 2021-01-29 13:32:56 UTC
If BiblioAddsAuthorities and AutoCreateAuthorities are enabled, a new record is auto linked when saving and authorities generated with a 670 field that indicates which record generated the new authority.

The code to do this is called before the biblionumber is generated, so the variable that adds the biblionumber to the citation is empty

To recreate:
1 - Enable BiblioAddsAuthorities and AutoCreateAuthorities
2 - Import or create a new record
3 - Ensure the record has controlled fields that do not have authorities before saving, i.e.:
    Add a 650 with "test_bug_01"
4 - Search for the authority record
5 - Note the 670 field does not contain the biblionumber
Comment 1 Nick Clemens 2021-01-29 13:36:45 UTC
Created attachment 116030 [details] [review]
Bug 27577: Autolink biblio after biblionumber is generated

If BiblioAddsAuthorities and AutoCreateAuthorities are enabled, a new record is auto linked when saving and authorities generated with a 670 field that indicates which record generated the new authority.

The code to do this is called before the biblionumber is generated, so the variable that adds the biblionumber to the citation is empty

This patch moves the linking code to after the biblionumber is generated

To recreate:
1 - Enable BiblioAddsAuthorities and AutoCreateAuthorities
2 - Import or create a new record
3 - Ensure the record has controlled fields that do not have authorities before saving, i.e.:
    Add a 650 with "test_bug_27577_01"
4 - Search for the authority record
5 - Note the 670 field does not contain the biblionumber
6 - Apply patch, restart all the things
7 - Repeat 2-4
8 - Note the 670 now has the biblionumber
Comment 2 Phil Ringnalda 2021-02-12 21:28:53 UTC
Created attachment 116851 [details] [review]
Bug 27577: Autolink biblio after biblionumber is generated

If BiblioAddsAuthorities and AutoCreateAuthorities are enabled, a new record is auto linked when saving and authorities generated with a 670 field that indicates which record generated the new authority.

The code to do this is called before the biblionumber is generated, so the variable that adds the biblionumber to the citation is empty

This patch moves the linking code to after the biblionumber is generated

To recreate:
1 - Enable BiblioAddsAuthorities and AutoCreateAuthorities
2 - Import or create a new record
3 - Ensure the record has controlled fields that do not have authorities before saving, i.e.:
    Add a 650 with "test_bug_27577_01"
4 - Search for the authority record
5 - Note the 670 field does not contain the biblionumber
6 - Apply patch, restart all the things
7 - Repeat 2-4
8 - Note the 670 now has the biblionumber

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Comment 3 Katrin Fischer 2021-02-14 14:07:48 UTC
Created attachment 116854 [details] [review]
Bug 27577: Autolink biblio after biblionumber is generated

If BiblioAddsAuthorities and AutoCreateAuthorities are enabled, a new record is auto linked when saving and authorities generated with a 670 field that indicates which record generated the new authority.

The code to do this is called before the biblionumber is generated, so the variable that adds the biblionumber to the citation is empty

This patch moves the linking code to after the biblionumber is generated

To recreate:
1 - Enable BiblioAddsAuthorities and AutoCreateAuthorities
2 - Import or create a new record
3 - Ensure the record has controlled fields that do not have authorities before saving, i.e.:
    Add a 650 with "test_bug_27577_01"
4 - Search for the authority record
5 - Note the 670 field does not contain the biblionumber
6 - Apply patch, restart all the things
7 - Repeat 2-4
8 - Note the 670 now has the biblionumber

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Katrin Fischer 2021-02-14 14:08:17 UTC
Obviously a bug fix, but for the future I think a regression test would be really helpful here.
Comment 5 Jonathan Druart 2021-02-15 10:48:27 UTC
Nick, can you try to provide a test for this change please?
Comment 6 Nick Clemens 2021-05-05 18:34:28 UTC
Created attachment 120559 [details] [review]
Bug 27577: Unit test
Comment 7 Nick Clemens 2021-05-05 18:34:32 UTC
Created attachment 120560 [details] [review]
Bug 27577: Autolink biblio after biblionumber is generated

If BiblioAddsAuthorities and AutoCreateAuthorities are enabled, a new record is auto linked when saving and authorities generated with a 670 field that indicates which record generated the new authority.

The code to do this is called before the biblionumber is generated, so the variable that adds the biblionumber to the citation is empty

This patch moves the linking code to after the biblionumber is generated

To recreate:
1 - Enable BiblioAddsAuthorities and AutoCreateAuthorities
2 - Import or create a new record
3 - Ensure the record has controlled fields that do not have authorities before saving, i.e.:
    Add a 650 with "test_bug_27577_01"
4 - Search for the authority record
5 - Note the 670 field does not contain the biblionumber
6 - Apply patch, restart all the things
7 - Repeat 2-4
8 - Note the 670 now has the biblionumber

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Jonathan Druart 2021-05-07 12:41:19 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 9 Fridolin Somers 2021-05-11 14:03:21 UTC
Pushed to 20.11.x for 20.11.06
Comment 10 Andrew Fuerste-Henry 2021-05-25 12:07:20 UTC
Pushed to 20.05.x for 20.05.12
Comment 11 Victor Grousset/tuxayo 2021-05-25 14:27:32 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.