From 1160f8132473f37736d998e729dbe5e26116ccfc Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Tue, 12 Aug 2025 00:56:00 +0000 Subject: [PATCH] Bug 39589: OPAC search returns 'No results found' despite existing matching records This issue occurs when the records on the first page of results are not displayed. The message "No results found" is shown, and it is not possible to access records on other pages. To test 1. Set the following system preferences: OPACnumSearchResults to 5 OpacHiddenItemsHidesRecord to Hide OpacHiddenItems to withdrawn: [1] 2. Create 6 bibliographic records with the following titles: "notice test 1" "notice test 2" "notice test 3" "notice test 4" "notice test 5" "notice test 6" 3. For the first 5 records, add an item with Withdrawn status. 4. For "notice test 6", add an item with Available status. 5. In the OPAC interface, search for "notice test". 6. Apply the patch 7. Repeat step 4 ---> The results table is now shown with the message: "Search results on this page are not available." ---> You can now access the second page and see "notice test 6" Signed-off-by: David Nind --- .../bootstrap/en/modules/opac-results.tt | 389 +++++++++--------- opac/opac-search.pl | 4 +- 2 files changed, 201 insertions(+), 192 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 131972bc3e0..65423c9ac9f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -192,70 +192,65 @@
[% INCLUDE 'page-numbers.inc' %]
- [% UNLESS tag %] -
- - - - [% IF Koha.Preference('OPACnumSearchResultsDropdown') %] - - + [% INCLUDE 'resort_form.inc' %] - [% END # IF Koha.Preference('OPACnumSearchResultsDropdown') %] -
- -
- -
- - [% END # /UNLESS tag %] + + [% IF Koha.Preference('OPACnumSearchResultsDropdown') %] + + + [% END # IF Koha.Preference('OPACnumSearchResultsDropdown') %] +
+ +
+ +
+ + [% END # /UNLESS tag %] + [% END %]
[% INCLUDE 'result-batch-controls.inc' results=1 %] + [% IF no_result %] +

Search results on this page are not available.

+ [% END %] - - - Results - - - [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %] - - [%# Cell 1: Checkbox %] - [% IF ( SEARCH_RESULT.title ) %] - [% check_title = SEARCH_RESULT.title %] - [% ELSE %] - [% check_title = SEARCH_RESULT.biblionumber %] - [% END %] - + + [% END # / FOREACH SEARCH_RESULT %] + + [% END %] diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 200df0beac4..1aa8aa06179 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -669,7 +669,9 @@ for ( my $i = 0 ; $i < @servers ; $i++ ) { $search_context, $query_desc, $hits, $results_per_page, $offset, $scan, $results_hashref->{$server}->{"RECORDS"}, $variables ); - $hits = 0 unless @newresults; + unless (@newresults) { + $template->param( no_result => 1 ); + } my $art_req_itypes; if ( C4::Context->preference('ArticleRequests') ) { -- 2.34.1