Bug 29374

Summary: searchResults explodes if biblio record has been deleted
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: SearchingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: andrewfh, kyle, nick, victor
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.15
Bug Depends on: 3142    
Bug Blocks:    
Attachments: Bug 29374: Don't crash if search engine returns a deleted record

Description Jonathan Druart 2021-10-29 13:40:25 UTC
From commit 1ad0e172cddce560afcc23579948d0c4a1eca71c
     Bug 3142: Use filter_by_for_holds where holdability is calculated

+            $can_place_holds = $biblio_object->items->filter_by_for_hold()->count;

This is exploding early in C4::Search::searchResults if the record is indexed but deleted from the DB.


Can't call method "items" on an undefined value at /kohadevbox/koha/C4/Search.pm line 2000                                                                                                                                   C4::Search::searchResults('HASH(0x55dc9a4076c0)', 'kw,wrdl: d', 432, 20, 0, undef, 'ARRAY(0x55dc9a3757e8)', 'HASH(0x55dc99f94a50)') called at /kohadevbox/koha/opac/opac-search.pl line 613
Comment 1 Jonathan Druart 2021-10-29 13:41:13 UTC
Created attachment 127096 [details] [review]
Bug 29374: Don't crash if search engine returns a deleted record
Comment 2 Jonathan Druart 2021-10-29 13:49:00 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 3 Nick Clemens 2022-05-12 19:29:37 UTC
*** Bug 30386 has been marked as a duplicate of this bug. ***
Comment 4 Andrew Fuerste-Henry 2022-05-29 15:47:40 UTC
Pushed to 21.05.x for 21.05.15