From ad58bc4223e1c33178627ab40a86fcc320631afb Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Sat, 9 Jun 2012 15:17:04 +0200 Subject: [PATCH] Bug 5771 - Follow up MT2894 Adds a download link for big error reports to import_borrowers --- .../prog/en/modules/tools/import_borrowers.tt | 2 +- tools/import_borrowers.pl | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt index 1a0b509..0b736a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt @@ -53,7 +53,7 @@
Error analysis:
[% IF download_errors %]
- " /> +
diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl index 1f40b69..f10d741 100755 --- a/tools/import_borrowers.pl +++ b/tools/import_borrowers.pl @@ -57,6 +57,7 @@ use Text::CSV; use CGI; # use encoding 'utf8'; # don't do this +my $commandline = @ARGV ? 1 : 0; my (@errors, @feedback); my $extended = C4::Context->preference('ExtendedPatronAttributes'); my $set_messaging_prefs = C4::Context->preference('EnhancedMessagingPreferences'); @@ -156,6 +157,8 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { my @bad_dates; # I've had a few. my $date_re = C4::Dates->new->regexp('syspref'); my $iso_re = C4::Dates->new->regexp('iso'); + my $lastalreadyindb; + my $lastinvalid; LINE: while ( my $borrowerline = <$handle> ) { my %borrower; my @missing_criticals; @@ -254,7 +257,8 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { # borrower exists unless ($overwrite_cardnumber) { $alreadyindb++; - $template->param('lastalreadyindb'=>$borrower{'surname'}.' / '.$borrowernumber); + $lastalreadyindb = $borrower{'surname'}.' / '.$borrowernumber; + $template->param('lastalreadyindb'=>$lastalreadyindb); next LINE; } $borrower{'borrowernumber'} = $borrowernumber; @@ -273,7 +277,8 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { $invalid++; # untill we have better error trapping, we have no way of knowing why ModMember errored out... push @errors, {unknown_error => 1}; - $template->param('lastinvalid'=>$borrower{'surname'}.' / '.$borrowernumber); + $lastinvalid = $borrower{'surname'}.' / '.$borrowernumber; + $template->param('lastinvalid'=>$lastinvalid); next LINE; } if ($extended) { -- 1.7.4.1