Bugzilla – Attachment 116179 Details for
Bug 27586
Import patrons script has a confirm switch that doesn't do anything
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27586: Import patrons script has a confirm switch that doesn't nothing!
Bug-27586-Import-patrons-script-has-a-confirm-swit.patch (text/plain), 2.26 KB, created by
Kyle M Hall (khall)
on 2021-02-01 18:25:59 UTC
(
hide
)
Description:
Bug 27586: Import patrons script has a confirm switch that doesn't nothing!
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-02-01 18:25:59 UTC
Size:
2.26 KB
patch
obsolete
>From 4a4e81a5e6e5b2d461d33562d812b155a58ec40e Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 1 Feb 2021 13:22:58 -0500 >Subject: [PATCH] Bug 27586: Import patrons script has a confirm switch that > doesn't nothing! > >If the script misc/import_patrons.pl is run without "--confirm" it reports >that it is "running in dry-run mode" but it is not! > >Test Plan: >1) Import a CSV of patrons using import_patrons.pm *without* the --confirm parameter >2) Note that it does actually import the patrons >3) Apply this patch >4) Note that this time the patrons are not actually imported >5) Import again with --confirm >6) Note that the patrons were actually imported this time! >--- > Koha/Patrons/Import.pm | 6 ++++++ > misc/import_patrons.pl | 1 + > 2 files changed, 7 insertions(+) > >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index 7839c4fb85..6f5646a416 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -73,9 +73,13 @@ sub import_patrons { > my $ext_preserve = $params->{preserve_extended_attributes}; > my $overwrite_cardnumber = $params->{overwrite_cardnumber}; > my $overwrite_passwords = $params->{overwrite_passwords}; >+ my $dry_run = $params->{dry_run}; > my $extended = C4::Context->preference('ExtendedPatronAttributes'); > my $set_messaging_prefs = C4::Context->preference('EnhancedMessagingPreferences'); > >+ my $schema = Koha::Database->new->schema; >+ $schema->storage->txn_begin if $dry_run; >+ > my @columnkeys = $self->set_column_keys($extended); > my @feedback; > my @errors; >@@ -425,6 +429,8 @@ sub import_patrons { > invalid => $invalid, > imported_borrowers => \@imported_borrowers, > }; >+ >+ $schema->storage->txn_rollback if $dry_run; > } > > =head2 prepare_columns >diff --git a/misc/import_patrons.pl b/misc/import_patrons.pl >index b341308c68..b3bbb66e87 100755 >--- a/misc/import_patrons.pl >+++ b/misc/import_patrons.pl >@@ -65,6 +65,7 @@ my $return = $Import->import_patrons( > overwrite_cardnumber => $overwrite_cardnumber, > overwrite_passwords => $overwrite_passwords, > preserve_extended_attributes => $ext_preserve, >+ dry_run => !$confirm, > } > ); > >-- >2.24.1 (Apple Git-126)
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 27586
:
116179
|
116338
|
116390
|
116452
|
116453