From 0ab77a620bd3a539e47e09ff29e1e91ddc4864dd Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 7 Jan 2014 10:19:37 -0700 Subject: [PATCH] Bug 11489: in OPAC search, display "no results" when the only search result is suppressed If hidelostitems is enabled, and the result of an opac search is a single lost item, then the OPAC will display a 404 error, rather than a "no results" screen. Test Plan: 1) Catalog a record/item such that it is the only result for some search e.g. Give it the title 'zxcvb' 2) Enable hidelostitems 3) Mark this item as lost 4) Perform an OPAC search that should result in a redirect to this record 5) Notice you a redirected to a 404 error 6) Apply this patch 7) Repeat step 4 8) Note you new get a "No results found!" page instead Signed-off-by: Christopher Brannon Signed-off-by: Michot Signed-off-by: Katrin Fischer Signed-off-by: Galen Charlton (cherry picked from commit 2277a42c565e18475c49fde031268b8038575e1a) Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall (cherry picked from commit b3c73cff32c99f12b77a9b110e2a928f5dfd1679) --- opac/opac-search.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 788599579a..40cbae7a10 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -559,6 +559,7 @@ for (my $i=0;$i<@servers;$i++) { @newresults = searchResults('opac', $query_desc, $hits, $results_per_page, $offset, $scan, $results_hashref->{$server}->{"RECORDS"}); } + $hits = 0 unless @newresults; # must define a value for size if not present in DB # in order to avoid problems generated by the default size value in TT @@ -615,7 +616,7 @@ for (my $i=0;$i<@servers;$i++) { } if ($results_hashref->{$server}->{"hits"}){ - $total = $total + $results_hashref->{$server}->{"hits"}; + $total = $total + $hits; } # Opac search history