Bug 18343

Summary: Manage MARC import DBH should not be shared
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: ToolsAssignee: Fridolin Somers <fridolin.somers>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: jonathan.druart+koha
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7790
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16880
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18329
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17240
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 8970    
Bug Blocks:    
Attachments: Bug 18343 - Manage MARC import DBH should not be shared

Description Fridolin Somers 2017-03-28 07:32:31 UTC
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.
Comment 1 Fridolin Somers 2017-03-28 13:18:28 UTC
Created attachment 61659 [details] [review]
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.
Comment 2 Fridolin Somers 2017-03-28 13:31:38 UTC
I've created this patch in order to do like Bug 8970, mainly for stable branches.

Maybe another must change to use DBIx transactions like in Bug 18329.
Comment 3 Jonathan Druart 2017-03-28 14:46:36 UTC
Why do not you implement transaction using DBIx::Class directly?
That will be easier and backportable as well.
Comment 4 Fridolin Somers 2017-05-12 13:29:44 UTC
(In reply to Jonathan Druart from comment #3)
> Why do not you implement transaction using DBIx::Class directly?
> That will be easier and backportable as well.

It was to have a quick fix.
Is it backportable to 3.22 ?
Comment 5 Jonathan Druart 2017-05-12 14:21:48 UTC
The quick fix is to use DBIx::Class transactions.
Comment 6 Fridolin Somers 2017-06-27 15:00:10 UTC

*** This bug has been marked as a duplicate of bug 18806 ***