From 62ec98bf7a4f28793a19e1e8d6a785ac70b1a240 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 | 391 +++++++++--------- opac/opac-search.pl | 4 +- 2 files changed, 201 insertions(+), 194 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 96eae27072..9850c1adb4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -196,71 +196,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 db9dc776c3..ca6a57ed3c 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.52.0