From c650764e951eb35c60482e06494816ecaeedb200 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 25 Jul 2017 10:29:06 -0300 Subject: [PATCH] Bug 17829: Fix import patron Can't call method "unblessed" on an undefined value at /home/vagrant/kohaclone/tools/import_borrowers.pl line 230, <$fh> line 2. Signed-off-by: Jonathan Druart --- tools/import_borrowers.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl index 76dc2995bd..66190e2737 100755 --- a/tools/import_borrowers.pl +++ b/tools/import_borrowers.pl @@ -227,15 +227,9 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { my $borrowernumber; my $member; if ( ($matchpoint eq 'cardnumber') && ($borrower{'cardnumber'}) ) { - $member = Koha::Patrons->find( { cardnumber => $borrower{'cardnumber'} } )->unblessed; - if ($member) { - $borrowernumber = $member->{'borrowernumber'}; - } + $member = Koha::Patrons->find( { cardnumber => $borrower{'cardnumber'} } ); } elsif ( ($matchpoint eq 'userid') && ($borrower{'userid'}) ) { $member = Koha::Patrons->find( { userid => $borrower{'userid'} } )->unblessed; - if ($member) { - $borrowernumber = $member->{'borrowernumber'}; - } } elsif ($extended) { if (defined($matchpoint_attr_type)) { foreach my $attr (@$patron_attributes) { @@ -248,6 +242,13 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { } } + if ($member) { + $member = $member->unblessed; + $borrowernumber = $member->{'borrowernumber'}; + } else { + $member = {}; + } + if ( C4::Members::checkcardnumber( $borrower{cardnumber}, $borrowernumber ) ) { push @errors, { invalid_cardnumber => 1, -- 2.39.5