Bugzilla – Attachment 160384 Details for
Bug 35653
Allow the patron import script to log it's output to the action_logs cron logging
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35653: Log import_patroni.pl info to action logs
Bug-35653-Log-importpatronipl-info-to-action-logs.patch (text/plain), 2.64 KB, created by
David Nind
on 2023-12-31 20:57:44 UTC
(
hide
)
Description:
Bug 35653: Log import_patroni.pl info to action logs
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-12-31 20:57:44 UTC
Size:
2.64 KB
patch
obsolete
>From 38ae6ef6fd7878d61b9f5974b795ff6b73788f4d Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Wed, 27 Dec 2023 17:35:31 +0000 >Subject: [PATCH] Bug 35653: Log import_patroni.pl info to action logs > >To test: >1. APPLY PATCH >2. Create a CSV file with a few lines that contain at least firstname, surname, cardnumber >3. Turn on "CronjobLog". >4. Run the import patron script. I did this: perl /kohadevbox/koha/misc/import_patrons.pl --file 'test1.csv' --matchpoint cardnumber -c >5. Check the action logs for cronjobs. >6. You should see info. about the import patron script. > >Signed-off-by: David Nind <david@davidnind.com> >--- > misc/import_patrons.pl | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > >diff --git a/misc/import_patrons.pl b/misc/import_patrons.pl >index cba3addc69..9428177414 100755 >--- a/misc/import_patrons.pl >+++ b/misc/import_patrons.pl >@@ -24,6 +24,7 @@ use Pod::Usage qw( pod2usage ); > > use Koha::Script; > use Koha::Patrons::Import; >+use C4::Log qw( cronlogaction ); > my $Import = Koha::Patrons::Import->new(); > > my $csv_file; >@@ -40,6 +41,9 @@ my @preserve_fields; > my $update_dateexpiry; > my $update_dateexpiry_from_today; > >+ >+my $command_line_options = join(" ",@ARGV); >+ > GetOptions( > 'c|confirm' => \$confirm, > 'f|file=s' => \$csv_file, >@@ -60,7 +64,11 @@ pod2usage(1) if $help; > pod2usage(q|--file is required|) unless $csv_file; > pod2usage(q|--matchpoint is required|) unless $matchpoint; > >-warn "Running in dry-run mode, provide --confirm to apply the changes\n" unless $confirm; >+if ( $confirm ) { >+ cronlogaction({ action => 'Run', info => $command_line_options }) >+} else { >+ warn "Running in dry-run mode, provide --confirm to apply the changes\n"; >+} > > my $handle; > open( $handle, "<", $csv_file ) or die $!; >@@ -87,9 +95,9 @@ my $imported = $return->{imported}; > my $overwritten = $return->{overwritten}; > my $alreadyindb = $return->{already_in_db}; > my $invalid = $return->{invalid}; >+my $total = $imported + $alreadyindb + $invalid + $overwritten; > > if ($verbose) { >- my $total = $imported + $alreadyindb + $invalid + $overwritten; > say q{}; > say "Import complete:"; > say "Imported: $imported"; >@@ -110,6 +118,12 @@ if ($verbose > 2 ) { > say Data::Dumper::Dumper( $feedback ); > } > >+my $info = "Import complete. " . "Imported: " . $imported . " Overwritten: " . $overwritten . " Skipped: " . $alreadyindb . " Invalid: " . $invalid . " Total: " . $total; >+ >+if ( $confirm ) { >+ cronlogaction({ action => 'End', info => $info }); >+} >+ > =head1 NAME > > import_patrons.pl - CLI script to import patrons data into Koha >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35653
:
160325
|
160384
|
161727
|
161728