From c91eb80efb3b715fcb825f5cfd11cc6b152cbcb2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Jul 2017 15:23:17 -0300 Subject: [PATCH] Bug 17829: (follow-up) Move GetMember to Koha::Patron Prevent crash at the opac when no user is logged in Signed-off-by: Jonathan Druart --- opac/opac-ISBDdetail.pl | 2 +- opac/opac-MARCdetail.pl | 4 ++-- opac/opac-detail.pl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 175d3465ce..f341884377 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -174,7 +174,7 @@ for my $itm (@items) { && !$itemtypes->{$itm->{'itype'}}->{notforloan} && $itm->{'itemnumber'}; - $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed($itm, $patron->unblessed) + $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, ( $patron ? $patron->unblessed : {} ) ) unless $allow_onshelf_holds; } diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index d758af2891..115e8fd9e8 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -127,9 +127,9 @@ if(my $cart_list = $query->cookie("bib_list")){ } my $allow_onshelf_holds; -my $patron = Koha::Patrons->find( $loggedinuser )->unblessed; +my $patron = Koha::Patrons->find( $loggedinuser ); for my $itm (@all_items) { - $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed($itm, $patron); + $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, ( $patron ? $patron->unblessed : {} ) ); last if $allow_onshelf_holds; } diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index a56ed6a96b..ed8a5d56aa 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -668,7 +668,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) { && !$itemtypes->{$itm->{'itype'}}->{notforloan} && $itm->{'itemnumber'}; - $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, $patron->unblessed ) + $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, ( $patron ? $patron->unblessed : {} ) ) unless $allow_onshelf_holds; # get collection code description, too -- 2.39.5