Bug 28885: Skip invalid biblios for OpacBrowseResults
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 19 Aug 2021 14:49:34 +0000 (10:49 -0400)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 8 Sep 2021 20:38:01 +0000 (10:38 -1000)
commitb6c9ab1197f8f140ac1dbda46b7d520fe4fd6c80
tree8420f7ba5ee0eee5a547d46c9cff4aff6929a124
parent89d2401f63925dfc2a1846a5feee4f36eec04743
Bug 28885: Skip invalid biblios for OpacBrowseResults

If a record is deleted from Koha, but is for some reason not deleted from the search indexes, OpacBrowseResults can cause an ISE if the deleted record is in the search results for any given item. OpacBrowseResults loops through the search results, and checks if there is a biblionumber, but does *not* check to see if a result was pulled from the database for that biblionumber. It simply assumes the result must exist.

We should be checking to ensure the biblionumber was valid before operating on the biblio object.

Test Plan:
1) Use zebra for searching
2) Disable koha-indexer
3) Enable OpacBrowseResults
4) Perform a search
5) Delete an item in the search results
6) View on of the remaining items in the search results
7) Note the error
8) Apply this patch
9) Restart plack
10) Reload the page
11) The error should be gone!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit a478eb1b4f52d3fb1fa2e8526511e5eb11df1619)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
opac/opac-detail.pl