From bd122369dcdc69bde1c66d2aecc2e0b4bcc744b4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 4 Jan 2018 10:05:46 -0300 Subject: [PATCH] Bug 12598: Remove warnings from tests and make them pass Signed-off-by: Jonathan Druart --- Koha/Patrons/Import.pm | 4 ++-- t/db_dependent/Koha/Patrons/Import.t | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index 4af3cd6db2..db77a3be7b 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -167,7 +167,7 @@ sub import_patrons { if ( defined($matchpoint) && ( $matchpoint eq 'cardnumber' ) && ( $borrower{'cardnumber'} ) ) { $member = Koha::Patrons->find( { cardnumber => $borrower{'cardnumber'} } ); } - elsif ( ($matchpoint eq 'userid') && ($borrower{'userid'}) ) { + elsif ( defined($matchpoint) && ($matchpoint eq 'userid') && ($borrower{'userid'}) ) { $member = Koha::Patrons->find( { userid => $borrower{userid} } ); } elsif ($extended) { @@ -201,7 +201,7 @@ sub import_patrons { } # Check if the userid provided does not exist yet - if ( $matchpoint ne 'userid' and exists $borrower{userid} + if ( defined($matchpoint) and $matchpoint ne 'userid' and exists $borrower{userid} and $borrower{userid} and not Check_Userid( $borrower{userid}, $borrower{borrowernumber} ) ) { push @errors, { duplicate_userid => 1, userid => $borrower{userid} }; diff --git a/t/db_dependent/Koha/Patrons/Import.t b/t/db_dependent/Koha/Patrons/Import.t index 4e4bde49f5..e5738bb021 100644 --- a/t/db_dependent/Koha/Patrons/Import.t +++ b/t/db_dependent/Koha/Patrons/Import.t @@ -317,7 +317,6 @@ subtest 'test_prepare_columns' => sub { plan tests => 16; # Given ... no header row - my $headerrow_0; my %csvkeycol_0; my @errors_0; -- 2.39.5