use Modern::Perl;
-use Getopt::Long;
-use Pod::Usage;
+use Getopt::Long qw( GetOptions );
+use Pod::Usage qw( pod2usage );
use Koha::Script;
use Koha::Patrons::Import;
my $csv_file;
my $matchpoint;
my $overwrite_cardnumber;
+my $overwrite_passwords;
+my $welcome_new = 0;
my %defaults;
my $ext_preserve = 0;
my $confirm;
my $verbose = 0;
my $help;
+my @preserve_fields;
GetOptions(
- 'c|confirm' => \$confirm,
- 'f|file=s' => \$csv_file,
- 'm|matchpoint=s' => \$matchpoint,
- 'd|default=s' => \%defaults,
- 'o|overwrite' => \$overwrite_cardnumber,
+ 'c|confirm' => \$confirm,
+ 'f|file=s' => \$csv_file,
+ 'm|matchpoint=s' => \$matchpoint,
+ 'd|default=s' => \%defaults,
+ 'o|overwrite' => \$overwrite_cardnumber,
+ 'op|overwrite_passwords' => \$overwrite_passwords,
+ 'en|email-new' => \$welcome_new,
'p|preserve-extended-attributes' => \$ext_preserve,
- 'v|verbose+' => \$verbose,
- 'h|help|?' => \$help,
+ 'pf|preserve-field=s' => \@preserve_fields,
+ 'v|verbose+' => \$verbose,
+ 'h|help|?' => \$help,
) or pod2usage(2);
pod2usage(1) if $help;
defaults => \%defaults,
matchpoint => $matchpoint,
overwrite_cardnumber => $overwrite_cardnumber,
+ overwrite_passwords => $overwrite_passwords,
preserve_extended_attributes => $ext_preserve,
+ preserve_fields => \@preserve_fields,
+ send_welcome => $welcome_new,
+ dry_run => !$confirm,
}
);
=head1 SYNOPSIS
-import_patrons.pl --file /path/to/patrons.csv --matchpoint cardnumber --confirm [--default branchcode=MPL] [--overwrite] [--preserve-extended-attributes] [--verbose]
+import_patrons.pl --file /path/to/patrons.csv --matchpoint cardnumber --confirm [--default branchcode=MPL] [--overwrite] [--preserve_field <column>] [--preserve-extended-attributes] [--verbose]
=head1 OPTIONS
Set defaults to patron fields, repeatable e.g. --default branchcode=MPL --default categorycode=PT
+=item B<-k|--preserve-field>
+
+Prevent specified patron fields for existing patrons from being overwritten
+
=item B<-o|--overwrite>
Overwrite existing patrons with new data if a match is found
Retain extended patron attributes for existing patrons being overwritten
+=item B<-en|--email-new>
+
+Send the WELCOME notice email to new users
+
=item B<-v|--verbose>
Be verbose
+Multiple -v options increase the verbosity
+
+2 repetitions or above will report lines in error
+
+3 repetitions or above will report feedback
+
=back
=cut