Bug 28573

Summary: Replace authority record with Z39.50/SRU creates new authority record
Product: Koha Reporter: Sebastian Krieg <sebastian.krieg>
Component: Staff interfaceAssignee: George Veranis <gveranis>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P3 CC: andrew, ephetteplace, florian.bontemps, fridolin.somers, gmcharlt, gveranis, hayleypelham, kyle.m.hall, kyle, m.de.rooy, martin.renvoize, mvsonmez, nick, rkuiper
Version: MainKeywords: Academy
Hardware: All   
OS: Linux   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.05
Circulation function:
Bug Depends on: 23302    
Bug Blocks:    
Attachments: Bug28573: Replace authority record with Z39.50/SRU creates new authority record
Bug28573: Replace authority record with Z39.50/SRU creates new authority record
Bug28573: Replace authority record with Z39.50/SRU creates new authority record
Bug 28573: Replace authority record with Z39.50/SRU creates new authority record

Description Sebastian Krieg 2021-06-16 14:11:53 UTC
When replacing an authority record with Z39.50/SRU you get a new record and no update of the upgrading record.

Test instance: Catalyst IT Ltd. (New Zealand)
(https://koha-community.org/demo/)

example record: #13 (name: Plato)

Steps to reproduce:
1. Menu "Home > Authorities > Details for authority #13 (Personal Name)"
2. Form: https://demo-intra.mykoha.co.nz/cgi-bin/koha/authorities/detail.pl?authid=13
3. Menu "Edit > Replace record via Z39.50/SRU"
4. Field "Name(any)": Homer >> Click "search"
5. choose the second entry "Aschmann, Homer, 1920-" >> click "import"

Expected solution:
- replace the record #13 with the search data "Aschmann, Homer, 1920-"
- Form: https://demo-intra.mykoha.co.nz/cgi-bin/koha/authorities/detail.pl?authid=13

Error:
- Menu "Home > Authorities > Adding authority Personal Name"
- form: https://demo-intra.mykoha.co.nz/cgi-bin/koha/authorities/authorities.pl?breedingid=58824&authtypecode=PERSO_NAME&index=
- Save the record as Record #14
- Menu "Home > Authorities > Details for authority #14 (Personal Name)"

Note: I found this error in release 21.05., I use a instance 20.11. to reproduce the error.
Comment 1 Sebastian Krieg 2021-06-18 07:27:53 UTC
Specify the fields "Hardware" and "Importance".
Comment 2 Volkan Sonmez 2021-07-02 12:16:35 UTC
That is because authid parameter is missing in z3950_auth_search.tt. So authorities.pl think that this is new authority file but not modification. if you change

<li><a href="/cgi-bin/koha/authorities/authorities.pl?breedingid=[% breeding_loo.breedingid | uri %]&authtypecode=[% breeding_loo.heading_code | uri %]&index=[% index | uri %]" class="chosen" title="Import"><i class="fa fa-download"></i> Import</a></li>

line with

<li><a href="/cgi-bin/koha/authorities/authorities.pl?breedingid=[% breeding_loo.breedingid | uri %]&authtypecode=[% breeding_loo.heading_code | uri %]&authid=[% breeding_loo.authid | uri %]&index=[% index | uri %]" class="chosen" title="Import"><i class="fa fa-download"></i> Import</a></li>

in 

cataloguing/z3950_auth_search.tt

file it will work.
Comment 3 Sebastian Krieg 2021-07-05 06:24:46 UTC
Thank you for this workaround, it work's. Will this workaround include in the a next release?
Comment 4 Katrin Fischer 2021-07-05 06:30:01 UTC
Hi, if you change NEW to ASSIGNED this indicates that you plan on providing a patch for this issue. Better to leave it as new to alert devs there is still someone needed to fix this here.

If you intend to provide a patch, please change back and also fill in the "Assignee" field.

Right now this needs a developer to take it up in order to make it into a release. As the solution is already provided and tested, I am marking it Academy (easy ones for grab) and upping severity a bit as this would be likely to create unwanted duplicates.
Comment 5 Sebastian Krieg 2021-07-05 08:02:41 UTC
Hello, thanks for this information. It's OK. Thank you.
Comment 6 George Veranis 2021-10-12 20:57:08 UTC
*** Bug 26776 has been marked as a duplicate of this bug. ***
Comment 7 George Veranis 2021-10-12 21:13:16 UTC
Created attachment 126130 [details] [review]
Bug28573: Replace authority record with Z39.50/SRU creates new authority record

When trying to replace an authority record with Z39.50/SRU then a new authority
record is created without deleting the old one and not link the new one with
any record.

This patch fixes that.

Test plan:

1) Try to catalogue a new authority record from cataloguing form.
2) Try to replace that authority record with Z39.50/SRU, then a new authority
record is created and also you have that one that you tried to replace.
3) Apply the patch.
4) Try to replace the authority from step1 with Z39.50/SRU, then is working as
expected.
Comment 8 Florian 2021-10-13 10:27:39 UTC Comment hidden (obsolete)
Comment 9 Andrew Fuerste-Henry 2021-10-13 11:48:01 UTC
Created attachment 126178 [details] [review]
Bug28573: Replace authority record with Z39.50/SRU creates new authority record

When trying to replace an authority record with Z39.50/SRU then a new authority
record is created without deleting the old one and not link the new one with
any record.

This patch fixes that.

Test plan:

1) Try to catalogue a new authority record from cataloguing form.
2) Try to replace that authority record with Z39.50/SRU, then a new authority
record is created and also you have that one that you tried to replace.
3) Apply the patch.
4) Try to replace the authority from step1 with Z39.50/SRU, then is working as
expected.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 10 Andrew Fuerste-Henry 2021-10-13 11:51:26 UTC
(In reply to Florian from comment #8)
> Does not seem to work. When replacing created authority with Z39.50/SRU
> after patch, it does replace the details of the authority but it does not
> change its title.

I'm not sure I understand the issue you ran into. I tested this with a topical term subject authority. When my replace-via-z39.50 changed the 150$a in my authority, its title changed as expected. Or did you mean something other than the title of the authority itself?
Comment 11 Florian 2021-10-13 12:43:20 UTC
My apologies, it seems part of the testing plan got lost in translation on my side! Disregard my previous comment.

(In reply to Andrew Fuerste-Henry from comment #10)
> (In reply to Florian from comment #8)
> > Does not seem to work. When replacing created authority with Z39.50/SRU
> > after patch, it does replace the details of the authority but it does not
> > change its title.
> 
> I'm not sure I understand the issue you ran into. I tested this with a
> topical term subject authority. When my replace-via-z39.50 changed the 150$a
> in my authority, its title changed as expected. Or did you mean something
> other than the title of the authority itself?
Comment 12 Eric Phetteplace 2021-10-20 17:51:57 UTC
Created attachment 126594 [details] [review]
Bug28573: Replace authority record with Z39.50/SRU creates new authority record

When trying to replace an authority record with Z39.50/SRU then a new authority
record is created without deleting the old one and not link the new one with
any record.

This patch fixes that.

Test plan:

1) Try to catalogue a new authority record from cataloguing form.
2) Try to replace that authority record with Z39.50/SRU, then a new authority
record is created and also you have that one that you tried to replace.
3) Apply the patch.
4) Try to replace the authority from step1 with Z39.50/SRU, then is working as
expected.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Comment 13 Martin Renvoize (ashimema) 2021-11-01 14:55:08 UTC
Created attachment 127174 [details] [review]
Bug 28573: Replace authority record with Z39.50/SRU creates new authority record

When trying to replace an authority record with Z39.50/SRU then a new authority
record is created without deleting the old one and not link the new one with
any record.

This patch fixes that.

Test plan:

1) Try to catalogue a new authority record from cataloguing form.
2) Try to replace that authority record with Z39.50/SRU, then a new authority
record is created and also you have that one that you tried to replace.
3) Apply the patch.
4) Try to replace the authority from step1 with Z39.50/SRU, then is working as
expected.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize (ashimema) 2021-11-01 14:55:31 UTC
Nice work.. Works as expected, no regressions found.

Passing QA
Comment 15 Jonathan Druart 2021-11-02 15:53:13 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 16 Hayley Pelham 2021-11-04 01:42:54 UTC
Hello, 

As this is a major bug and the button doesn't do as it says, could this please be backported to 21.05.x?

Cheers,
Hayley
Comment 17 Rhonda Kuiper 2021-11-04 21:59:35 UTC
Please backport this to 21.05.  The problem fixed by this bug is creating a lot of extra work for our catalogers that we didn't have to do when we were on 20.05.
Comment 18 Kyle M Hall (khall) 2021-11-05 12:22:10 UTC
Pushed to 21.05.x for 21.05.05
Comment 19 Hayley Pelham 2021-11-07 20:12:47 UTC
(In reply to Kyle M Hall from comment #18)
> Pushed to 21.05.x for 21.05.05

21.05.06?
Comment 20 Fridolin Somers 2021-11-11 00:34:59 UTC
Depends on Bug 23302 not in 20.11.x