Lines 1-7
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
use strict; |
3 |
use Modern::Perl; |
4 |
use warnings; |
4 |
|
5 |
BEGIN { |
5 |
BEGIN { |
6 |
# find Koha's Perl modules |
6 |
# find Koha's Perl modules |
7 |
# test carefully before changing this |
7 |
# test carefully before changing this |
Lines 43-50
if ($list_batches) {
Link Here
|
43 |
# in future, probably should tie to a real user account |
43 |
# in future, probably should tie to a real user account |
44 |
C4::Context->set_userenv(0, 'batch', 0, 'batch', 'batch', 'batch', 'batch'); |
44 |
C4::Context->set_userenv(0, 'batch', 0, 'batch', 'batch', 'batch', 'batch'); |
45 |
|
45 |
|
46 |
my $dbh = C4::Context->dbh; |
|
|
47 |
$dbh->{AutoCommit} = 0; |
48 |
if ($batch_number =~ /^\d+$/ and $batch_number > 0) { |
46 |
if ($batch_number =~ /^\d+$/ and $batch_number > 0) { |
49 |
my $batch = GetImportBatch($batch_number); |
47 |
my $batch = GetImportBatch($batch_number); |
50 |
die "$0: import batch $batch_number does not exist in database\n" unless defined $batch; |
48 |
die "$0: import batch $batch_number does not exist in database\n" unless defined $batch; |
Lines 57-63
if ($batch_number =~ /^\d+$/ and $batch_number > 0) {
Link Here
|
57 |
unless $batch->{'import_status'} eq "staged" or $batch->{'import_status'} eq "reverted"; |
55 |
unless $batch->{'import_status'} eq "staged" or $batch->{'import_status'} eq "reverted"; |
58 |
process_batch($batch_number); |
56 |
process_batch($batch_number); |
59 |
} |
57 |
} |
60 |
$dbh->commit(); |
|
|
61 |
} else { |
58 |
} else { |
62 |
die "$0: please specify a numeric batch ID\n"; |
59 |
die "$0: please specify a numeric batch ID\n"; |
63 |
} |
60 |
} |
Lines 128-136
_SUMMARY_
Link Here
|
128 |
|
125 |
|
129 |
|
126 |
|
130 |
sub print_progress_and_commit { |
127 |
sub print_progress_and_commit { |
131 |
my $recs = shift; |
128 |
my ( $recs, $schema ) = @_; |
132 |
print "... processed $recs records\n"; |
129 |
print "... processed $recs records\n"; |
133 |
$dbh->commit(); |
130 |
$schema->txn_commit; |
134 |
} |
131 |
} |
135 |
|
132 |
|
136 |
sub print_usage { |
133 |
sub print_usage { |
137 |
- |
|
|