Bug 16056 - Error when deleting MARC authority
Summary: Error when deleting MARC authority
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL: /cgi-bin/koha/authorities/authorities...
Keywords:
Depends on: 15381
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-11 19:03 UTC by Owen Leonard
Modified: 2019-06-27 09:24 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 16056: Do not crash when searching for an authority if zebra's index is not up-to-date (1.61 KB, patch)
2016-03-21 15:35 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 16056: [ALT] Do not crash when searching for an authority if zebra's index is not up-to-date (1.54 KB, patch)
2016-03-21 15:38 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 16056: [ALT] Do not crash when searching for an authority if zebra's index is not up-to-date (1.81 KB, patch)
2016-03-23 12:53 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 16056: Do not crash when searching for an authority if zebra's index is not up-to-date (1.67 KB, patch)
2016-04-01 18:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2016-03-11 19:03:45 UTC
When I try to delete a MARC authority record from the authority search results list (Authorities -> Search) I get an error.

Can't call method "authtypecode" on an undefined value at C4/AuthoritiesMarc.pm line 305.

I think the authority is being deleted correctly but the out-of-date index is triggering an error, because reloading the search results page triggers the error again. Reindexing makes it go away.

I'm guessing this is related to Bug 15380 or Bug 15381.
Comment 1 Jonathan Druart 2016-03-21 15:35:16 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2016-03-21 15:38:47 UTC Comment hidden (obsolete)
Comment 3 Owen Leonard 2016-03-23 12:53:05 UTC Comment hidden (obsolete)
Comment 4 Tomás Cohen Arazi 2016-03-23 14:50:18 UTC
I think the right behaviour would be that Koha raises an error when trying to delete a record it is not on the DB.

Hey, what would happen if we filter non-existent indexed records out, and then someone deletes "another" record in the meantime?

The best approach is to make Koha handle this situations elegantly, instead of adding more and more latency to search results rendering.

I vote for: render the deleted record, using Zebra's data as usual. Then show an error box if the user tries to delete it.
Comment 5 Jonathan Druart 2016-03-23 16:14:05 UTC
Tomas, this patch fixes a a major regression, I don't think we should have this discussion here :) Let's go with the first patch if you think the second one is not good enough.
Comment 6 Owen Leonard 2016-03-23 16:51:30 UTC
The first patch eliminates the error but from the point of view of the user it appears as if the deletion never happened.
Comment 7 Jonathan Druart 2016-03-23 17:15:40 UTC
(In reply to Owen Leonard from comment #6)
> The first patch eliminates the error but from the point of view of the user
> it appears as if the deletion never happened.

Yes, that was I have attached the second patch. But it was the behavior before 15381 (and I guess it has already been like that).
Comment 8 Jonathan Druart 2016-03-29 07:54:06 UTC
Removing the in discussion status to get other opinions. Pick the patch you want, but pick one :)
Comment 9 Tomás Cohen Arazi 2016-04-01 18:01:52 UTC
Created attachment 49810 [details] [review]
Bug 16056: Do not crash when searching for an authority if zebra's index is not up-to-date

This patch fixes a regression introduced by
commit 7e70202d34d75f988fbaea9b911347417c203aac
  Bug 15381: Remove GetAuthType and GetAuthTypeCode

This first version will reintroduce the same behavior as before bug
15381: the record will be displayed even if it's no in the DB

Test plan:
Search for authorities
delete one
The zebra's index is not updated yet and the results will contain the
record you have deleted.

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Comment 10 Brendan Gallagher 2016-04-01 19:05:25 UTC
Pushed to Master - Should be in the May 2016 release.  Thanks!
Comment 11 Julian Maurice 2016-04-06 13:07:47 UTC
Not needed in stable versions, status changed to RESOLVED