From 86a1246fcef0456758c7c61985d427202bbfb860 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 4 Sep 2012 08:15:19 +0800 Subject: [PATCH] Bug 4064 - Uninitialized variable errors in opac-search.pl In 3.6.3 the error was triggered. It was already fixed with some particularly ugly logic: if (($params->{'offset'}||'') eq '') { Having read through the code, $offset is a better choice and produces prettier, clearer code: if (!$offset) { Signed-off-by: Chris Cormack --- opac/opac-search.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 5f3ad8608c..206bbf2133 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -591,7 +591,7 @@ for (my $i=0;$i<@servers;$i++) { # Adding the new search if needed if (!$borrowernumber || $borrowernumber eq '') { # To a cookie (the user is not logged in) - if (($params->{'offset'}||'') eq '') { + if (!$offset) { push @recentSearches, { "query_desc" => $query_desc || "unknown", "query_cgi" => $query_cgi || "unknown", @@ -613,7 +613,7 @@ for (my $i=0;$i<@servers;$i++) { } else { # To the session (the user is logged in) - if (($params->{'offset'}||'') eq '') { + if (!$offset) { AddSearchHistory($borrowernumber, $cgi->cookie("CGISESSID"), $query_desc, $query_cgi, $total); $template->param(ShowOpacRecentSearchLink => 1); } -- 2.39.5