Bug 28600: (bug 18989 follow-up) Resolve variable scope issue

This patch fixes a scope issue. Originally, a variable declared as

our $borcat

was replaced by

my $patron

This patch makes the method not rely on global variables, but have a
parameter for the patron, and thus things are clearer.

To test:
1. Open the OPAC detail page for a record
=> FAIL: The logs show some errors about the $patron variable not
available in the scope
2. Apply this patch
3. Repeat 1
=> SUCCESS: No errors
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2021-06-18 15:20:30 -03:00 committed by Jonathan Druart
parent 883ee12560
commit b033366bea
1 changed files with 3 additions and 3 deletions

View File

@ -260,7 +260,7 @@ if ($session->param('busc')) {
# Search given the current values from the busc param
sub searchAgain
{
my ($arrParamsBusc, $offset, $results_per_page) = @_;
my ($arrParamsBusc, $offset, $results_per_page, $patron) = @_;
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
my @servers;
@ -341,7 +341,7 @@ if ($session->param('busc')) {
}
$arrParamsBusc{'count'} = $count;
$results_per_page = $count;
my $newresultsRef = searchAgain(\%arrParamsBusc, $offset, $results_per_page);
my $newresultsRef = searchAgain(\%arrParamsBusc, $offset, $results_per_page, $patron);
$arrParamsBusc{'listBiblios'} = buildListBiblios($newresultsRef, $results_per_page);
delete $arrParamsBusc{'previous'} if (exists($arrParamsBusc{'previous'}));
delete $arrParamsBusc{'next'} if (exists($arrParamsBusc{'next'}));
@ -452,7 +452,7 @@ if ($session->param('busc')) {
$offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
}
if ($searchAgain) {
my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page, $patron);
my @newresults = @$newresultsRef;
# build the new listBiblios
my $listBiblios = buildListBiblios(\@newresults, $results_per_page);