From cfa76a35771bb5035e51ff70f8b35439a77cac2a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 14 Mar 2016 18:41:02 +0000 Subject: [PATCH] Bug 16073: Fix software error in circulation.pl Can't call method "guarantor" on an undefined value at /home/koha/src/circ/circulation.pl line 588. at /home/koha/src/circ/circulation.pl line 673 Introduced by bug 15656 Test plan: Just trigger circ/circulation.pl Signed-off-by: Jacek Ablewicz Triggered circ/circulation.pl - nothing exploded, and error is gone Signed-off-by: Tomas Cohen Arazi Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- circ/circulation.pl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 924db654b2..74a7524c85 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -583,13 +583,15 @@ my $view = $batch ?'batch_checkout_view' : 'circview'; -my $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); my @relatives; -if ( my $guarantor = $patron->guarantor ) { - push @relatives, $guarantor->borrowernumber; - push @relatives, $_->borrowernumber for $patron->siblings; -} else { - push @relatives, $_->borrowernumber for $patron->guarantees; +if ( $borrowernumber ) { + my $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); + if ( my $guarantor = $patron->guarantor ) { + push @relatives, $guarantor->borrowernumber; + push @relatives, $_->borrowernumber for $patron->siblings; + } else { + push @relatives, $_->borrowernumber for $patron->guarantees; + } } my $relatives_issues_count = Koha::Database->new()->schema()->resultset('Issue') -- 2.39.5