Bug 37425 - Deletion of bibliographic record can cause search errors
Summary: Deletion of bibliographic record can cause search errors
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Julian Maurice
URL:
Keywords: rel_23_11_candidate
Depends on: 35558
Blocks:
  Show dependency treegraph
 
Reported: 2024-07-22 19:46 UTC by Nick Clemens (kidclamp)
Modified: 2024-09-18 04:02 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00,24.05.04,23.11.09
Circulation function:


Attachments
Bug 37425: Check for existence of biblio object before fetching cover images (1.73 KB, patch)
2024-07-22 19:49 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 37425: Check for existence of biblio object before fetching cover images (1.78 KB, patch)
2024-07-23 14:35 UTC, Roman Dolny
Details | Diff | Splinter Review
Bug 37425: Check for existence of biblio object before fetching cover images (1.84 KB, patch)
2024-07-24 14:39 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2024-07-22 19:46:05 UTC
Bug 35558 added a check to see if the associated biblio has local cover images, however, when a biblio is deleted there is a delay in the background job reindexing the biblio. This can lead to 500 errors when a search retrieves the biblio before it has been removed from the index.

To recreate:
1 - Enabled system preference LocalCoverImages
2 - Perform a search in staff interface
3 - Find the biblionumebr for one of the results and delete it via the SQL backend:
    DELETE FROM biblio WHERE biblionumber=3;
4 - Search again.
5 - KO!
    Can't call method "cover_images" on an undefined value at /usr/share/koha/intranet/cgi-bin/catalogue/search.pl line 671.
6 - Reindex, confirm error is gone
Comment 1 Nick Clemens (kidclamp) 2024-07-22 19:49:54 UTC
Created attachment 169380 [details] [review]
Bug 37425: Check for existence of biblio object before fetching cover images

This patch simply adds a conditional to ensure the biblio object has been retrieved and assumes no cover images otherwise

To test:
 1 - Enable system preference LocalCoverImages
 2 - Perform a search in staff interface
 3 - Find the biblionumebr for one of the results and delete it via the SQL backend:
     DELETE FROM biblio WHERE biblionumber=3;
 4 - Search again.
 5 - KO!
     Can't call method "cover_images" on an undefined value at /usr/share/koha/intranet/cgi-bin/catalogue/search.pl line 671.
 6 - Reindex, confirm error is gone
 7 - Apply patch
 8 - Search again
 9 - Delete a record from the results via SQL
10 - Reload and confirm no error
11 - Reindex and repeat search and confirm no error
Comment 2 Roman Dolny 2024-07-23 14:35:44 UTC
Created attachment 169425 [details] [review]
Bug 37425: Check for existence of biblio object before fetching cover images

This patch simply adds a conditional to ensure the biblio object has been retrieved and assumes no cover images otherwise

To test:
 1 - Enable system preference LocalCoverImages
 2 - Perform a search in staff interface
 3 - Find the biblionumebr for one of the results and delete it via the SQL backend:
     DELETE FROM biblio WHERE biblionumber=3;
 4 - Search again.
 5 - KO!
     Can't call method "cover_images" on an undefined value at /usr/share/koha/intranet/cgi-bin/catalogue/search.pl line 671.
 6 - Reindex, confirm error is gone
 7 - Apply patch
 8 - Search again
 9 - Delete a record from the results via SQL
10 - Reload and confirm no error
11 - Reindex and repeat search and confirm no error

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 3 Julian Maurice 2024-07-24 14:39:15 UTC
Created attachment 169495 [details] [review]
Bug 37425: Check for existence of biblio object before fetching cover images

This patch simply adds a conditional to ensure the biblio object has been retrieved and assumes no cover images otherwise

To test:
 1 - Enable system preference LocalCoverImages
 2 - Perform a search in staff interface
 3 - Find the biblionumebr for one of the results and delete it via the SQL backend:
     DELETE FROM biblio WHERE biblionumber=3;
 4 - Search again.
 5 - KO!
     Can't call method "cover_images" on an undefined value at /usr/share/koha/intranet/cgi-bin/catalogue/search.pl line 671.
 6 - Reindex, confirm error is gone
 7 - Apply patch
 8 - Search again
 9 - Delete a record from the results via SQL
10 - Reload and confirm no error
11 - Reindex and repeat search and confirm no error

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 4 Julian Maurice 2024-07-24 14:40:32 UTC
Trivial patch. QA script doesn't complain. Passed QA
Comment 5 Martin Renvoize (ashimema) 2024-07-25 10:13:45 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 6 CJ Lynce 2024-07-26 16:22:20 UTC
A kind request to backport to 24.05? Thx!
Comment 7 David Cook 2024-08-14 07:03:40 UTC
Yeah this will need to be backported all the way back to 23.11
Comment 8 Katrin Fischer 2024-08-14 07:15:34 UTC
(In reply to David Cook from comment #7)
> Yeah this will need to be backported all the way back to 23.11

You can use the rel_ keywords to indicate that to the RMaints.
Comment 9 Lucas Gass (lukeg) 2024-08-28 20:36:04 UTC
Backported to 24.05.x for upcoming 24.05.04
Comment 10 Fridolin Somers 2024-09-10 14:14:57 UTC
Don't we need the same on opac/opac-search.pl ?
Comment 11 Fridolin Somers 2024-09-10 14:16:40 UTC
Pushed to 23.11.x for 23.11.09
Comment 12 Wainui Witika-Park 2024-09-18 04:02:13 UTC
Not backporting to 23.05.x unless requested