From d9d50baedb2008d684147e56e2d8fb896001b6ea Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 20 Mar 2018 04:03:44 +0000 Subject: [PATCH] Bug 20340: Followup to allow OPAC login to complete The Plugin authenticates correctly, the problem is there is no patron to match with, and so there is nothing to check for authorization and user-details once a login is attempted. This will at least let it fail gracefully. --- opac/opac-user.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 1fde24b..6957cc3 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -89,14 +89,15 @@ $template->param( shibbolethAuthentication => C4::Context->config('useshibboleth # get borrower information .... my $patron = Koha::Patrons->find( $borrowernumber ); -my $borr = $patron->unblessed; + +my $borr = $patron ? $patron->unblessed : {}; # unblessed is a hash vs. object/undef. Hence the use of curly braces here. my $borcat = $borr ? $borr->{categorycode} : q{}; my ( $today_year, $today_month, $today_day) = Today(); my ($warning_year, $warning_month, $warning_day) = split /-/, $borr->{'dateexpiry'}; -my $debar = Koha::Patrons->find( $borrowernumber )->is_debarred; +my $debar = $patron ? $patron->is_debarred : undef; my $userdebarred; if ($debar) { @@ -119,7 +120,7 @@ if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { $canrenew = 0; } -my $amountoutstanding = $patron->account->balance; +my $amountoutstanding = $patron ? $patron->account->balance : 0; if ( $amountoutstanding > 5 ) { $borr->{'amountoverfive'} = 1; } -- 2.7.4