Bug 16073: (follow-up) Fix software error in circulation.pl

Do not crash if the patron does not exist.

Test plan:
Access circ/circulation.pl?borrowernumber=42424242
you should get an error without this patch
With this patch, you will get an empty patron detail page (should be
fixed in another patch, but this behavior exists for a while)

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
Jonathan Druart 2016-03-16 09:32:58 +00:00 committed by Brendan Gallagher
parent cfa76a3577
commit 8d64bb9eb0
1 changed files with 7 additions and 6 deletions

View File

@ -585,12 +585,13 @@ my $view = $batch
my @relatives;
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;
if ( 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 =