From 2cd0f388fa5e6bf21a1608cb548157485c060392 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 22 Aug 2017 13:34:17 -0300 Subject: [PATCH] Bug 12598: Re-add bug 18555: Create patron list from patron import Signed-off-by: Colin Campbell Signed-off-by: Jonathan Druart --- Koha/Patrons/Import.pm | 3 +++ tools/import_borrowers.pl | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index c785604766..ab73d99048 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -82,6 +82,7 @@ sub import_patrons { my $alreadyindb = 0; my $overwritten = 0; my $invalid = 0; + my @imported_borrowers; my $matchpoint_attr_type = $self->set_attribute_types({ extended => $extended, matchpoint => $matchpoint, }); # Use header line to construct key to column map @@ -320,6 +321,7 @@ sub import_patrons { } $imported++; + push @imported_borrowers, $borrowernumber; #for patronlist push( @feedback, { @@ -350,6 +352,7 @@ sub import_patrons { overwritten => $overwritten, already_in_db => $alreadyindb, invalid => $invalid, + imported_borrowers => \@imported_borrowers, }; } diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl index c49a0bcd91..59168b6fb2 100755 --- a/tools/import_borrowers.pl +++ b/tools/import_borrowers.pl @@ -137,6 +137,13 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { my $overwritten = $return->{overwritten}; my $alreadyindb = $return->{already_in_db}; my $invalid = $return->{invalid}; + my $imported_borrowers = $return->{imported_borrowers}; + + if ( $imported && $createpatronlist ) { + my $patronlist = AddPatronList({ name => $patronlistname }); + AddPatronsToList({ list => $patronlist, borrowernumbers => $imported_borrowers }); + $template->param('patronlistname' => $patronlistname); + } my $uploadinfo = $input->uploadInfo($uploadborrowers); foreach ( keys %$uploadinfo ) { -- 2.39.5