From 6bb806ddf41c8263758948bf82dd0a41dda406b6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 27 Nov 2019 15:49:36 +0100 Subject: [PATCH] Bug 20443: Fix Patrons/Import.t ->get_patrons has been removed but not replaced! Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- Koha/Patrons/Import.pm | 10 ++++++++-- t/db_dependent/Koha/Patrons/Import.t | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index 413aae3a12..8ced08cba4 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -174,8 +174,14 @@ sub import_patrons { elsif ($extended) { if ( defined($matchpoint_attr_type) ) { foreach my $attr (@$patron_attributes) { - if ( $attr->{code} eq $matchpoint and $attr->{value} ne '' ) { - my @borrowernumbers = $matchpoint_attr_type->get_patrons( $attr->{value} ); + if ( $attr->{code} eq $matchpoint and $attr->{attribute} ne '' ) { + my @borrowernumbers = Koha::Patron::Attributes->search( + { + code => $matchpoint_attr_type->code, + attribute => $attr->{attribute} + } + )->get_column('borrowernumber'); + $borrowernumber = $borrowernumbers[0] if scalar(@borrowernumbers) == 1; $patron = Koha::Patrons->find( $borrowernumber ); last; diff --git a/t/db_dependent/Koha/Patrons/Import.t b/t/db_dependent/Koha/Patrons/Import.t index e7af90a3a7..784d929b76 100644 --- a/t/db_dependent/Koha/Patrons/Import.t +++ b/t/db_dependent/Koha/Patrons/Import.t @@ -217,7 +217,6 @@ my $params_4 = { file => $handle_4, matchpoint => $attribute->{code}, }; # When ... my $result_4 = $patrons_import->import_patrons($params_4); -use Data::Printer colored => 1; warn p $result_4; # Then ... is($result_4->{already_in_db}, 0, 'Got the expected 0 already_in_db from import_patrons with extended user'); -- 2.39.5