View | Details | Raw Unified | Return to bug 35653
Collapse All | Expand All

(-)a/misc/import_patrons.pl (-3 / +16 lines)
Lines 24-29 use Pod::Usage qw( pod2usage ); Link Here
24
24
25
use Koha::Script;
25
use Koha::Script;
26
use Koha::Patrons::Import;
26
use Koha::Patrons::Import;
27
use C4::Log qw( cronlogaction );
27
my $Import = Koha::Patrons::Import->new();
28
my $Import = Koha::Patrons::Import->new();
28
29
29
my $csv_file;
30
my $csv_file;
Lines 40-45 my @preserve_fields; Link Here
40
my $update_dateexpiry;
41
my $update_dateexpiry;
41
my $update_dateexpiry_from_today;
42
my $update_dateexpiry_from_today;
42
43
44
45
my $command_line_options = join(" ",@ARGV);
46
43
GetOptions(
47
GetOptions(
44
    'c|confirm'                      => \$confirm,
48
    'c|confirm'                      => \$confirm,
45
    'f|file=s'                       => \$csv_file,
49
    'f|file=s'                       => \$csv_file,
Lines 60-66 pod2usage(1) if $help; Link Here
60
pod2usage(q|--file is required|) unless $csv_file;
64
pod2usage(q|--file is required|) unless $csv_file;
61
pod2usage(q|--matchpoint is required|) unless $matchpoint;
65
pod2usage(q|--matchpoint is required|) unless $matchpoint;
62
66
63
warn "Running in dry-run mode, provide --confirm to apply the changes\n" unless $confirm;
67
if ( $confirm ) {
68
    cronlogaction({ action => 'Run', info => $command_line_options })
69
} else {
70
    warn "Running in dry-run mode, provide --confirm to apply the changes\n";
71
}
64
72
65
my $handle;
73
my $handle;
66
open( $handle, "<", $csv_file ) or die $!;
74
open( $handle, "<", $csv_file ) or die $!;
Lines 87-95 my $imported = $return->{imported}; Link Here
87
my $overwritten = $return->{overwritten};
95
my $overwritten = $return->{overwritten};
88
my $alreadyindb = $return->{already_in_db};
96
my $alreadyindb = $return->{already_in_db};
89
my $invalid     = $return->{invalid};
97
my $invalid     = $return->{invalid};
98
my $total = $imported + $alreadyindb + $invalid + $overwritten;
90
99
91
if ($verbose) {
100
if ($verbose) {
92
    my $total = $imported + $alreadyindb + $invalid + $overwritten;
93
    say q{};
101
    say q{};
94
    say "Import complete:";
102
    say "Import complete:";
95
    say "Imported:    $imported";
103
    say "Imported:    $imported";
Lines 110-115 if ($verbose > 2 ) { Link Here
110
    say Data::Dumper::Dumper( $feedback );
118
    say Data::Dumper::Dumper( $feedback );
111
}
119
}
112
120
121
my $info = "Import complete. " . "Imported: " . $imported . " Overwritten: " . $overwritten . " Skipped: " . $alreadyindb . " Invalid: " . $invalid . " Total: " . $total;
122
123
if ( $confirm ) {
124
    cronlogaction({ action => 'End', info => $info });
125
}
126
113
=head1 NAME
127
=head1 NAME
114
128
115
import_patrons.pl - CLI script to import patrons data into Koha
129
import_patrons.pl - CLI script to import patrons data into Koha
116
- 

Return to bug 35653