From cd1d278a6cf6a65035c9e3e4653d30270855bf0f Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Fri, 20 Dec 2013 15:44:51 -0500 Subject: [PATCH] Bug 11432 - 404.pl redirect for single, hidden result makes no sense. In bug 10584, when searching for something in OPAC and a single, hidden result is returned, the default automatic redirect to the details/MARCdetails/ISBDdetails page triggers a 404.pl error page. This makes no sense. The correct behaviour would be to give no results. TEST PLAN --------- 1) OPAC Search for something (I started with stupid) 2) Narrow it to one item (I tweaked it to stupid things) 3) Detail page comes up 4) Staff client -> home -> administration -> global system preferences -> OPAC 5) OpacHiddenItems add "homebranch: [MAL,DAV,PAP]", changing MAL, DAV, PAP to the branches for items for this single biblio. 6) Search for the one item again in OPAC -- 404.pl is triggered. 4) Apply patch 5) Search again for the one item search -- No results is triggered (as expected) --- opac/opac-search.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 8604d0f..4317248 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -655,6 +655,15 @@ for (my $i=0;$i<@servers;$i++) { } } } + + ## If there's just one result, check if it is hidden + ## before trying to redirect. The biblionumber will + ## be undefined for a hidden result. + if ($total == 1 && ! defined($newresults[0]->{biblionumber})) { + $hits = 0; + $total = 0; + } + ## If there's just one result, redirect to the detail page if ($total == 1 && $format ne 'rss2' && $format ne 'opensearchdescription' && $format ne 'atom') { -- 1.7.9.5