Browse Source

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!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.05.x
Kyle Hall 3 years ago
committed by Jonathan Druart
parent
commit
d3005a2a4c
  1. 6
      Koha/Patrons/Import.pm
  2. 1
      misc/import_patrons.pl

6
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

1
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,
}
);

Loading…
Cancel
Save