|
Lines 234-248
sub commit_batch {
Link Here
|
| 234 |
my ($template, $import_batch_id, $framework) = @_; |
234 |
my ($template, $import_batch_id, $framework) = @_; |
| 235 |
|
235 |
|
| 236 |
my $job = undef; |
236 |
my $job = undef; |
| 237 |
$dbh->{AutoCommit} = 0; |
237 |
my ( $num_added, $num_updated, $num_items_added, |
| 238 |
my $callback = sub {}; |
238 |
$num_items_replaced, $num_items_errored, $num_ignored ); |
| 239 |
if ($runinbackground) { |
239 |
my $schema = Koha::Database->new->schema; |
| 240 |
$job = put_in_background($import_batch_id); |
240 |
$schema->storage->txn_do( |
| 241 |
$callback = progress_callback($job, $dbh); |
241 |
sub { |
| 242 |
} |
242 |
my $callback = sub { }; |
| 243 |
my ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored) = |
243 |
if ($runinbackground) { |
| 244 |
BatchCommitRecords($import_batch_id, $framework, 50, $callback); |
244 |
$job = put_in_background($import_batch_id); |
| 245 |
$dbh->commit(); |
245 |
$callback = progress_callback( $job, $dbh ); |
|
|
246 |
} |
| 247 |
( |
| 248 |
$num_added, $num_updated, $num_items_added, |
| 249 |
$num_items_replaced, $num_items_errored, $num_ignored |
| 250 |
) |
| 251 |
= BatchCommitRecords( $import_batch_id, $framework, 50, |
| 252 |
$callback ); |
| 253 |
} |
| 254 |
); |
| 246 |
|
255 |
|
| 247 |
my $results = { |
256 |
my $results = { |
| 248 |
did_commit => 1, |
257 |
did_commit => 1, |
|
Lines 263-278
sub commit_batch {
Link Here
|
| 263 |
sub revert_batch { |
272 |
sub revert_batch { |
| 264 |
my ($template, $import_batch_id) = @_; |
273 |
my ($template, $import_batch_id) = @_; |
| 265 |
|
274 |
|
| 266 |
$dbh->{AutoCommit} = 0; |
|
|
| 267 |
my $job = undef; |
275 |
my $job = undef; |
| 268 |
my $callback = sub {}; |
276 |
my ( |
| 269 |
if ($runinbackground) { |
277 |
$num_deleted, $num_errors, $num_reverted, |
| 270 |
$job = put_in_background($import_batch_id); |
278 |
$num_items_deleted, $num_ignored |
| 271 |
$callback = progress_callback($job, $dbh); |
279 |
); |
| 272 |
} |
280 |
my $schema = Koha::Database->new->schema; |
| 273 |
my ($num_deleted, $num_errors, $num_reverted, $num_items_deleted, $num_ignored) = |
281 |
$schema->txn_do( |
| 274 |
BatchRevertRecords($import_batch_id, 50, $callback); |
282 |
sub { |
| 275 |
$dbh->commit(); |
283 |
my $callback = sub { }; |
|
|
284 |
if ($runinbackground) { |
| 285 |
$job = put_in_background($import_batch_id); |
| 286 |
$callback = progress_callback( $job, $dbh ); |
| 287 |
} |
| 288 |
( |
| 289 |
$num_deleted, $num_errors, $num_reverted, |
| 290 |
$num_items_deleted, $num_ignored |
| 291 |
) = BatchRevertRecords( $import_batch_id, 50, $callback ); |
| 292 |
} |
| 293 |
); |
| 276 |
|
294 |
|
| 277 |
my $results = { |
295 |
my $results = { |
| 278 |
did_revert => 1, |
296 |
did_revert => 1, |
| 279 |
- |
|
|