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 <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2017-07-11 15:23:17 -03:00
parent fd28b02202
commit c91eb80efb
3 changed files with 4 additions and 4 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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