Bug 17095: (bug 16849 follow-up) Fix regression if patron does not exist

Bug 16082, 'Display a friendly "patron does not exist" message if that's the
case - circulation.pl' changed the behavior of the checkout page so that if
you hit that page with a borrowernumber which doesn't exist a nice message will
tell you so.

Now when you do that you get an error message:
  Can't call method "is_debarred" on an undefined value at /circ/circulation.pl line 300.

Test plan:
confirm that the friendly message is back :)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-08-09 20:08:54 +01:00 committed by Kyle M Hall
parent 739eaa82e8
commit 5ec898b401

View file

@ -297,7 +297,8 @@ if ($borrowernumber) {
finetotal => $fines finetotal => $fines
); );
if ( Koha::Patrons->find( $borrowernumber )->is_debarred ) { my $patron = Koha::Patrons->find( $borrowernumber );
if ( $patron and $patron->is_debarred ) {
$template->param( $template->param(
'userdebarred' => $borrower->{debarred}, 'userdebarred' => $borrower->{debarred},
'debarredcomment' => $borrower->{debarredcomment}, 'debarredcomment' => $borrower->{debarredcomment},