|
Lines 98-103
if ($completedJobID) {
Link Here
|
| 98 |
# BatchStageMarcRecords can handle that |
98 |
# BatchStageMarcRecords can handle that |
| 99 |
|
99 |
|
| 100 |
my $job = undef; |
100 |
my $job = undef; |
|
|
101 |
my $progress_interval = 0; |
| 102 |
my $progress_callback = undef; |
| 101 |
my $dbh; |
103 |
my $dbh; |
| 102 |
if ($runinbackground) { |
104 |
if ($runinbackground) { |
| 103 |
my $job_size = scalar(@$marcrecords); |
105 |
my $job_size = scalar(@$marcrecords); |
|
Lines 134-139
if ($completedJobID) {
Link Here
|
| 134 |
# New handle, as we're a child. |
136 |
# New handle, as we're a child. |
| 135 |
$dbh = C4::Context->dbh({new => 1}); |
137 |
$dbh = C4::Context->dbh({new => 1}); |
| 136 |
$dbh->{AutoCommit} = 0; |
138 |
$dbh->{AutoCommit} = 0; |
|
|
139 |
|
| 140 |
if ($runinbackground) { |
| 141 |
$progress_interval = 50; |
| 142 |
$progress_callback = staging_progress_callback( $job, $dbh ); |
| 143 |
} |
| 137 |
# FIXME branch code |
144 |
# FIXME branch code |
| 138 |
my ( $batch_id, $num_valid, $num_items, @import_errors ) = |
145 |
my ( $batch_id, $num_valid, $num_items, @import_errors ) = |
| 139 |
BatchStageMarcRecords( |
146 |
BatchStageMarcRecords( |
|
Lines 142-162
if ($completedJobID) {
Link Here
|
| 142 |
$to_marc_plugin, $marc_modification_template, |
149 |
$to_marc_plugin, $marc_modification_template, |
| 143 |
$comments, '', |
150 |
$comments, '', |
| 144 |
$parse_items, 0, |
151 |
$parse_items, 0, |
| 145 |
50, staging_progress_callback( $job, $dbh ) |
152 |
$progress_interval, $progress_callback |
| 146 |
); |
153 |
); |
| 147 |
|
154 |
|
| 148 |
my $num_with_matches = 0; |
155 |
my $num_with_matches = 0; |
| 149 |
my $checked_matches = 0; |
156 |
my $checked_matches = 0; |
| 150 |
my $matcher_failed = 0; |
157 |
my $matcher_failed = 0; |
| 151 |
my $matcher_code = ""; |
158 |
my $matcher_code = ""; |
|
|
159 |
if ($runinbackground) { |
| 160 |
$progress_interval = 50; |
| 161 |
$progress_callback = matching_progress_callback( $job, $dbh ); |
| 162 |
} |
| 152 |
if ($matcher_id ne "") { |
163 |
if ($matcher_id ne "") { |
| 153 |
my $matcher = C4::Matcher->fetch($matcher_id); |
164 |
my $matcher = C4::Matcher->fetch($matcher_id); |
| 154 |
if (defined $matcher) { |
165 |
if (defined $matcher) { |
| 155 |
$checked_matches = 1; |
166 |
$checked_matches = 1; |
| 156 |
$matcher_code = $matcher->code(); |
167 |
$matcher_code = $matcher->code(); |
| 157 |
$num_with_matches = |
168 |
$num_with_matches = |
| 158 |
BatchFindDuplicates( $batch_id, $matcher, 10, 50, |
169 |
BatchFindDuplicates( $batch_id, $matcher, 10, $progress_interval, $progress_callback ); |
| 159 |
matching_progress_callback( $job, $dbh ) ); |
|
|
| 160 |
SetImportBatchMatcher($batch_id, $matcher_id); |
170 |
SetImportBatchMatcher($batch_id, $matcher_id); |
| 161 |
SetImportBatchOverlayAction($batch_id, $overlay_action); |
171 |
SetImportBatchOverlayAction($batch_id, $overlay_action); |
| 162 |
SetImportBatchNoMatchAction($batch_id, $nomatch_action); |
172 |
SetImportBatchNoMatchAction($batch_id, $nomatch_action); |
|
Lines 221-226
exit 0;
Link Here
|
| 221 |
|
231 |
|
| 222 |
sub staging_progress_callback { |
232 |
sub staging_progress_callback { |
| 223 |
my $job = shift; |
233 |
my $job = shift; |
|
|
234 |
return unless $job; |
| 224 |
my $dbh = shift; |
235 |
my $dbh = shift; |
| 225 |
return sub { |
236 |
return sub { |
| 226 |
my $progress = shift; |
237 |
my $progress = shift; |
|
Lines 230-235
sub staging_progress_callback {
Link Here
|
| 230 |
|
241 |
|
| 231 |
sub matching_progress_callback { |
242 |
sub matching_progress_callback { |
| 232 |
my $job = shift; |
243 |
my $job = shift; |
|
|
244 |
return unless $job; |
| 233 |
my $dbh = shift; |
245 |
my $dbh = shift; |
| 234 |
my $start_progress = $job->progress(); |
246 |
my $start_progress = $job->progress(); |
| 235 |
return sub { |
247 |
return sub { |
| 236 |
- |
|
|