Bugzilla – Attachment 177207 Details for
Bug 38963
Deletion of bibliographic record can cause search errors in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38963: Check for existence of biblio object before fetching cover images in the OPAC
Bug-38963-Check-for-existence-of-biblio-object-bef.patch (text/plain), 2.10 KB, created by
David Cook
on 2025-01-28 04:30:29 UTC
(
hide
)
Description:
Bug 38963: Check for existence of biblio object before fetching cover images in the OPAC
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-01-28 04:30:29 UTC
Size:
2.10 KB
patch
obsolete
>From e954b527c926eda21d7d9f21644cf2c1cb7df88a Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Sat, 25 Jan 2025 00:02:52 +0000 >Subject: [PATCH] Bug 38963: Check for existence of biblio object before > fetching cover images in the OPAC > >This patch adds a conditional to ensure the biblio object has been retrieved >and assumes no cover images otherwise. This is similar to bug 37425 that >fixed the issue for the staff interface. > >Test plan: > 1. Enable the OPACLocalCoverImages system preference. > 2. Search in the OPAC (for example, attic). > 3. Find the biblionumber for one of the results and delete it > from the database using SQL: > DELETE FROM biblio WHERE biblionumber=3; > 4. Search again. > NOTE: Steps 3 and 4 need to be done very quickly to generate the error. > I had the terminal open with the SQL already loaded, and the browser > also open. > 5. Error trace generated: > Can't call method "cover_images" on an undefined value at /kohadevbox/koha/opac/opac-search.pl line 702. > at /kohadevbox/koha/opac/opac-search.pl line 701 > 6. Reindex, confirm error is gone: koha-rebuild-zebra -d -f -v kohadev > 7. Apply the patch. > 8. Repeat steps 2 to 4 - I searched for perl and used biblionumber 13. > 9. No error generated >10. Reindex and repeat search and confirm no error. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > opac/opac-search.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 54eabd8949..d52f96d01a 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -699,7 +699,7 @@ for (my $i=0;$i<@servers;$i++) { > $res->{artreqpossible} = ( $art_req_itypes->{ $res->{itemtype} // q{} } || $art_req_itypes->{ '*' } ) ? 1 : q{}; > > if ( C4::Context->preference('OPACLocalCoverImages') ) { >- $res->{has_local_cover_image} = $res->{biblio_object}->cover_images->count; >+ $res->{has_local_cover_image} = $res->{biblio_object} ? $res->{biblio_object}->cover_images->count : 0; > } > } > >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38963
:
177105
|
177136
| 177207