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 <chrisc@catalyst.net.nz>
(cherry picked from commit 86a1246fce)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Mark Tompsett 2012-09-04 08:15:19 +08:00 committed by Jared Camins-Esakov
parent 971c6e09c9
commit 394966711d
1 changed files with 2 additions and 2 deletions

View File

@ -537,7 +537,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",
@ -559,7 +559,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);
}