Bugzilla – Attachment 64377 Details for
Bug 18806
Cannot revert a batch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18806: Fix batch revert
Bug-18806-Fix-batch-revert.patch (text/plain), 3.41 KB, created by
Marcel de Rooy
on 2017-06-16 07:54:34 UTC
(
hide
)
Description:
Bug 18806: Fix batch revert
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-06-16 07:54:34 UTC
Size:
3.41 KB
patch
obsolete
>From 7f58b7183aabc548b6da819b44a28be405682654 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 14 Jun 2017 15:53:18 -0300 >Subject: [PATCH] Bug 18806: Fix batch revert >Content-Type: text/plain; charset=utf-8 > >Since bug 18242: When a biblio is deleted, a new transaction is created. >tools/manage-marc-import.pl use the AutoCommit flag, which does not >allow nested transaction. >AutoCommit must not be used. > >Test plan: >Import a batch, then revert it. >The biblios must have been correctly deleted, they were not before this >patch > >Signed-off-by: Lee Jamison <ldjamison@marywood.edu> >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > tools/manage-marc-import.pl | 54 ++++++++++++++++++++++++++++++--------------- > 1 file changed, 36 insertions(+), 18 deletions(-) > >diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl >index 249cabe..892ffe8 100755 >--- a/tools/manage-marc-import.pl >+++ b/tools/manage-marc-import.pl >@@ -234,15 +234,24 @@ sub commit_batch { > my ($template, $import_batch_id, $framework) = @_; > > my $job = undef; >- $dbh->{AutoCommit} = 0; >- my $callback = sub {}; >- if ($runinbackground) { >- $job = put_in_background($import_batch_id); >- $callback = progress_callback($job, $dbh); >- } >- my ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored) = >- BatchCommitRecords($import_batch_id, $framework, 50, $callback); >- $dbh->commit(); >+ my ( $num_added, $num_updated, $num_items_added, >+ $num_items_replaced, $num_items_errored, $num_ignored ); >+ my $schema = Koha::Database->new->schema; >+ $schema->storage->txn_do( >+ sub { >+ my $callback = sub { }; >+ if ($runinbackground) { >+ $job = put_in_background($import_batch_id); >+ $callback = progress_callback( $job, $dbh ); >+ } >+ ( >+ $num_added, $num_updated, $num_items_added, >+ $num_items_replaced, $num_items_errored, $num_ignored >+ ) >+ = BatchCommitRecords( $import_batch_id, $framework, 50, >+ $callback ); >+ } >+ ); > > my $results = { > did_commit => 1, >@@ -263,16 +272,25 @@ sub commit_batch { > sub revert_batch { > my ($template, $import_batch_id) = @_; > >- $dbh->{AutoCommit} = 0; > my $job = undef; >- my $callback = sub {}; >- if ($runinbackground) { >- $job = put_in_background($import_batch_id); >- $callback = progress_callback($job, $dbh); >- } >- my ($num_deleted, $num_errors, $num_reverted, $num_items_deleted, $num_ignored) = >- BatchRevertRecords($import_batch_id, 50, $callback); >- $dbh->commit(); >+ my ( >+ $num_deleted, $num_errors, $num_reverted, >+ $num_items_deleted, $num_ignored >+ ); >+ my $schema = Koha::Database->new->schema; >+ $schema->txn_do( >+ sub { >+ my $callback = sub { }; >+ if ($runinbackground) { >+ $job = put_in_background($import_batch_id); >+ $callback = progress_callback( $job, $dbh ); >+ } >+ ( >+ $num_deleted, $num_errors, $num_reverted, >+ $num_items_deleted, $num_ignored >+ ) = BatchRevertRecords( $import_batch_id, 50, $callback ); >+ } >+ ); > > my $results = { > did_revert => 1, >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18806
:
64298
|
64371
| 64377