|
Lines 101-106
if ($completedJobID) {
Link Here
|
| 101 |
# BatchStageMarcRecords can handle that |
101 |
# BatchStageMarcRecords can handle that |
| 102 |
|
102 |
|
| 103 |
my $job = undef; |
103 |
my $job = undef; |
|
|
104 |
my $progress_interval = 0; |
| 105 |
my $progress_callback = undef; |
| 104 |
my $dbh; |
106 |
my $dbh; |
| 105 |
if ($runinbackground) { |
107 |
if ($runinbackground) { |
| 106 |
my $job_size = scalar(@$marcrecords); |
108 |
my $job_size = scalar(@$marcrecords); |
|
Lines 137-142
if ($completedJobID) {
Link Here
|
| 137 |
# New handle, as we're a child. |
139 |
# New handle, as we're a child. |
| 138 |
$dbh = C4::Context->dbh({new => 1}); |
140 |
$dbh = C4::Context->dbh({new => 1}); |
| 139 |
$dbh->{AutoCommit} = 0; |
141 |
$dbh->{AutoCommit} = 0; |
|
|
142 |
|
| 143 |
if ($runinbackground) { |
| 144 |
$progress_interval = 50; |
| 145 |
$progress_callback = staging_progress_callback( $job, $dbh ); |
| 146 |
} |
| 140 |
# FIXME branch code |
147 |
# FIXME branch code |
| 141 |
my ( $batch_id, $num_valid, $num_items, @import_errors ) = |
148 |
my ( $batch_id, $num_valid, $num_items, @import_errors ) = |
| 142 |
BatchStageMarcRecords( |
149 |
BatchStageMarcRecords( |
|
Lines 145-165
if ($completedJobID) {
Link Here
|
| 145 |
$marc_modification_template, |
152 |
$marc_modification_template, |
| 146 |
$comments, '', |
153 |
$comments, '', |
| 147 |
$parse_items, 0, |
154 |
$parse_items, 0, |
| 148 |
50, staging_progress_callback( $job, $dbh ) |
155 |
$progress_interval, $progress_callback |
| 149 |
); |
156 |
); |
| 150 |
|
157 |
|
| 151 |
my $num_with_matches = 0; |
158 |
my $num_with_matches = 0; |
| 152 |
my $checked_matches = 0; |
159 |
my $checked_matches = 0; |
| 153 |
my $matcher_failed = 0; |
160 |
my $matcher_failed = 0; |
| 154 |
my $matcher_code = ""; |
161 |
my $matcher_code = ""; |
|
|
162 |
if ($runinbackground) { |
| 163 |
$progress_interval = 50; |
| 164 |
$progress_callback = matching_progress_callback( $job, $dbh ); |
| 165 |
} |
| 155 |
if ($matcher_id ne "") { |
166 |
if ($matcher_id ne "") { |
| 156 |
my $matcher = C4::Matcher->fetch($matcher_id); |
167 |
my $matcher = C4::Matcher->fetch($matcher_id); |
| 157 |
if (defined $matcher) { |
168 |
if (defined $matcher) { |
| 158 |
$checked_matches = 1; |
169 |
$checked_matches = 1; |
| 159 |
$matcher_code = $matcher->code(); |
170 |
$matcher_code = $matcher->code(); |
| 160 |
$num_with_matches = |
171 |
$num_with_matches = |
| 161 |
BatchFindDuplicates( $batch_id, $matcher, 10, 50, |
172 |
BatchFindDuplicates( $batch_id, $matcher, 10, $progress_interval, $progress_callback ); |
| 162 |
matching_progress_callback( $job, $dbh ) ); |
|
|
| 163 |
SetImportBatchMatcher($batch_id, $matcher_id); |
173 |
SetImportBatchMatcher($batch_id, $matcher_id); |
| 164 |
SetImportBatchOverlayAction($batch_id, $overlay_action); |
174 |
SetImportBatchOverlayAction($batch_id, $overlay_action); |
| 165 |
SetImportBatchNoMatchAction($batch_id, $nomatch_action); |
175 |
SetImportBatchNoMatchAction($batch_id, $nomatch_action); |
|
Lines 226-231
exit 0;
Link Here
|
| 226 |
|
236 |
|
| 227 |
sub staging_progress_callback { |
237 |
sub staging_progress_callback { |
| 228 |
my $job = shift; |
238 |
my $job = shift; |
|
|
239 |
return unless $job; |
| 229 |
my $dbh = shift; |
240 |
my $dbh = shift; |
| 230 |
return sub { |
241 |
return sub { |
| 231 |
my $progress = shift; |
242 |
my $progress = shift; |
|
Lines 235-240
sub staging_progress_callback {
Link Here
|
| 235 |
|
246 |
|
| 236 |
sub matching_progress_callback { |
247 |
sub matching_progress_callback { |
| 237 |
my $job = shift; |
248 |
my $job = shift; |
|
|
249 |
return unless $job; |
| 238 |
my $dbh = shift; |
250 |
my $dbh = shift; |
| 239 |
my $start_progress = $job->progress(); |
251 |
my $start_progress = $job->progress(); |
| 240 |
return sub { |
252 |
return sub { |
| 241 |
- |
|
|