|
Lines 1-7
Link Here
|
| 1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
| 2 |
|
2 |
|
| 3 |
# Copyright 2007 Liblime |
|
|
| 4 |
# Parts copyright 2010 BibLibre |
| 5 |
# Parts copyright 2014 ByWater Solutions |
3 |
# Parts copyright 2014 ByWater Solutions |
| 6 |
# |
4 |
# |
| 7 |
# This file is part of Koha. |
5 |
# This file is part of Koha. |
|
Lines 30-40
my $matchpoint;
Link Here
|
| 30 |
my $overwrite_cardnumber; |
28 |
my $overwrite_cardnumber; |
| 31 |
my %defaults; |
29 |
my %defaults; |
| 32 |
my $ext_preserve = 0; |
30 |
my $ext_preserve = 0; |
|
|
31 |
my $confirm; |
| 33 |
my $verbose = 0; |
32 |
my $verbose = 0; |
| 34 |
my $help; |
33 |
my $help; |
| 35 |
|
34 |
|
| 36 |
GetOptions( |
35 |
GetOptions( |
| 37 |
'c|csv=s' => \$csv_file, |
36 |
'c|confirm' => \$confirm, |
|
|
37 |
'f|file=s' => \$csv_file, |
| 38 |
'm|matchpoint=s' => \$matchpoint, |
38 |
'm|matchpoint=s' => \$matchpoint, |
| 39 |
'd|default=s' => \%defaults, |
39 |
'd|default=s' => \%defaults, |
| 40 |
'o|overwrite' => \$overwrite_cardnumber, |
40 |
'o|overwrite' => \$overwrite_cardnumber, |
|
Lines 43-49
GetOptions(
Link Here
|
| 43 |
'h|help|?' => \$help, |
43 |
'h|help|?' => \$help, |
| 44 |
); |
44 |
); |
| 45 |
|
45 |
|
| 46 |
print_help() if ( $help || !$csv_file || !$matchpoint ); |
46 |
print_help() if ( $help || !$csv_file || !$matchpoint || !$confirm ); |
| 47 |
|
47 |
|
| 48 |
my $handle; |
48 |
my $handle; |
| 49 |
open( $handle, "<", $csv_file ) or die $!; |
49 |
open( $handle, "<", $csv_file ) or die $!; |
|
Lines 89-96
if ($verbose > 2 ) {
Link Here
|
| 89 |
|
89 |
|
| 90 |
sub print_help { |
90 |
sub print_help { |
| 91 |
print <<_USAGE_; |
91 |
print <<_USAGE_; |
| 92 |
import_borrowers.pl -c /path/to/borrowers.csv -m cardnumber |
92 |
import_patrons.pl -c /path/to/patrons.csv -m cardnumber |
| 93 |
-c --csv Path to the CSV file of patrons to import |
93 |
-c --confirm Confirms you really want to import these patrons, otherwise prints this help |
|
|
94 |
-f --file Path to the CSV file of patrons to import |
| 94 |
-m --matchpoint Field on which to match incoming patrons to existing patrons |
95 |
-m --matchpoint Field on which to match incoming patrons to existing patrons |
| 95 |
-d --default Set defaults to patron fields, repeatable e.g. --default branchcode=MPL --default categorycode=PT |
96 |
-d --default Set defaults to patron fields, repeatable e.g. --default branchcode=MPL --default categorycode=PT |
| 96 |
-p --preserve-extended-atributes Retain extended patron attributes for existing patrons being overwritten |
97 |
-p --preserve-extended-atributes Retain extended patron attributes for existing patrons being overwritten |
| 97 |
- |
|
|