Bugzilla – Attachment 61659 Details for
Bug 18343
Manage MARC import DBH should not be shared
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18343 - Manage MARC import DBH should not be shared
Bug-18343---Manage-MARC-import-DBH-should-not-be-s.patch (text/plain), 2.78 KB, created by
Fridolin Somers
on 2017-03-28 13:18:28 UTC
(
hide
)
Description:
Bug 18343 - Manage MARC import DBH should not be shared
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2017-03-28 13:18:28 UTC
Size:
2.78 KB
patch
obsolete
>From 84cd58d8544b7334c8c6c1307bf620b86f07f71a Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Tue, 28 Mar 2017 10:48:30 +0200 >Subject: [PATCH] Bug 18343 - Manage MARC import DBH should not be shared > >Bug 8970 reported an issue with stage-marc-import.pl sharing the DB handler in Plack context. >There is the same issue with tools/manage-marc-import.pl. >To create a transaction, one must create a new DB handler. > >Test plan : > - In Staff interface Tools > - Go to "Stage MARC records for import" > - Import a marc records file with several records > - Click on "Manage staged records" > - Click on "Import this batch into the catalog" > - Click on "Undo import into catalog" >Test with and without Plack. >To test with Plack you may apply Bug 17240. >--- > tools/manage-marc-import.pl | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > >diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl >index 249cabe..0429e9e 100755 >--- a/tools/manage-marc-import.pl >+++ b/tools/manage-marc-import.pl >@@ -61,7 +61,6 @@ my ($template, $loggedinuser, $cookie) > > my %cookies = parse CGI::Cookie($cookie); > our $sessionID = $cookies{'CGISESSID'}->value; >-our $dbh = C4::Context->dbh; > > my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] }); > $template->param( frameworks => $frameworks ); >@@ -233,11 +232,13 @@ sub import_batches_list { > sub commit_batch { > my ($template, $import_batch_id, $framework) = @_; > >- my $job = undef; >+ # Use a DB transaction >+ my $dbh = C4::Context->dbh({new => 1}); > $dbh->{AutoCommit} = 0; >+ my $job = undef; > my $callback = sub {}; > if ($runinbackground) { >- $job = put_in_background($import_batch_id); >+ $job = put_in_background($import_batch_id, $dbh); > $callback = progress_callback($job, $dbh); > } > my ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored) = >@@ -263,11 +264,13 @@ sub commit_batch { > sub revert_batch { > my ($template, $import_batch_id) = @_; > >+ # Use a DB transaction >+ my $dbh = C4::Context->dbh({new => 1}); > $dbh->{AutoCommit} = 0; > my $job = undef; > my $callback = sub {}; > if ($runinbackground) { >- $job = put_in_background($import_batch_id); >+ $job = put_in_background($import_batch_id, $dbh); > $callback = progress_callback($job, $dbh); > } > my ($num_deleted, $num_errors, $num_reverted, $num_items_deleted, $num_ignored) = >@@ -291,6 +294,7 @@ sub revert_batch { > > sub put_in_background { > my $import_batch_id = shift; >+ my $dbh = shift; > > my $batch = GetImportBatch($import_batch_id); > my $job = C4::BackgroundJob->new($sessionID, $batch->{'file_name'}, '/cgi-bin/koha/tools/manage-marc-import.pl', $batch->{'num_records'}); >-- >2.7.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 18343
: 61659