When we stage and then import a file through tools, the biblionumber of the created record gets recorded in import_biblios.matched_biblionumber. When we stage a file and then use it to populate a basket in acquisitions, import_biblio.matched_biblionumber does not get populated. We see the same behavior whether the basket is populated using "From a staged file" or "From a new file." To Test: - Create a basket - Add to basket From a New File - Select a marc file and stage without checking for duplicates - Add titles to your basket - Confirm from acquisitions that new bibs were created - Go to manage-marc-import.pl and find your file - Confirm that the Record column is empty
Created attachment 98760 [details] [review] Bug 24469: Record biblionumber in import_biblio when adding to basket via file The column import_biblios.matched_biblionumber was not populated when an order is created from a staged file. Test plan: A/ Create a new order from a stage file. Use the "Save" button at the bottom of the "Add orders from" page Then note the matched_biblionumber value. It should be populated correctly B/ Import again the same record, this time you will have to use the "Add order" link in the list of order (ie. not the "Save" button) Note the matched_biblionumber value. It should be populated correctly
In my testing, matched_biblionumber remains null in test A using the Save button. Test B using the Add order link successfully populated matched_biblionumber.
Created attachment 99073 [details] [review] Bug 24469: Record biblionumber in import_biblio when adding to basket via file The column import_biblios.matched_biblionumber was not populated when an order is created from a staged file. Test plan: A/ Create a new order from a stage file. Use the "Save" button at the bottom of the "Add orders from" page Then note the matched_biblionumber value. It should be populated correctly B/ Import again the same record, this time you will have to use the "Add order" link in the list of order (ie. not the "Save" button) Note the matched_biblionumber value. It should be populated correctly
(In reply to Andrew Fuerste-Henry from comment #2) > In my testing, matched_biblionumber remains null in test A using the Save > button. Test B using the Add order link successfully populated > matched_biblionumber. Indeed, can you try again with this new patch please?
Patch no longer applies.
Created attachment 102805 [details] [review] Bug 24469: Record biblionumber in import_biblio when adding to basket via file The column import_biblios.matched_biblionumber was not populated when an order is created from a staged file. Test plan: A/ Create a new order from a stage file. Use the "Save" button at the bottom of the "Add orders from" page Then note the matched_biblionumber value. It should be populated correctly B/ Import again the same record, this time you will have to use the "Add order" link in the list of order (ie. not the "Save" button) Note the matched_biblionumber value. It should be populated correctly
I tried to reproduce the issue in two ways: 1. With an imported record not already in my catalog After the order was created the following sql query select * from import_biblios; shows that matched_biblionumber is null. 2. With an imported record that I just exported from my catalog When doing "Add orders from MARC file" after I hit save, I get the following message: > No records imported > No record have been imported because they all match an existing record in your catalog. > You'll have to treat them individually. Even though "Record matching rule = Do not look for matching records" in Home › Tools › Stage MARC records for import Did I miss something?
Don't import it. You should stage it, then create an order "From a staged file"
> You should stage it, then create an order "From a staged file" Whoops, I meant staged, terminology error. "Home › Acquisitions › My Vendor › Basket 1 › Add orders from MARC file" Which is the right way to try to reproduce? 1. With a staged record not already in my catalog 2. With a staged record that I just exported from my catalog
Message from Jonathan on IRC > about 24469 - the important bit is to use the "Add" link, not the "Save" button I'm not even a that part yet. It's A/ on first phase (bug reproduction) I'm not even hitting the actual bug. > A/ Create a new order from a stage file. > Use the "Save" button at the bottom of the "Add orders from" page > Then note the matched_biblionumber value. It should be populated correctly No matched_biblionumber. Tried with - Debian 10 & MariaDB - Debian 9 & MySQL 5.5 in case that was some compat issue. But no :(
No problem to reproduce bug on master. The patch works fine for me, except one point : I first thought status of staged files was very long to update from "Staged" to "Import", but after some tests on several files, it seems to me that status is updated only after I add an order using a new staged file. Did you experiment the same ?
(In reply to Séverine Queune from comment #11) > No problem to reproduce bug on master. > The patch works fine for me, except one point : I first thought status of > staged files was very long to update from "Staged" to "Import", but after > some tests on several files, it seems to me that status is updated only > after I add an order using a new staged file. > Did you experiment the same ? I thought we fixed that status change issue in bug 24470.
Fleshed out test plan based on general confusion. Test plan: A/ Create a new order from a stage file. Use the "Save" button at the bottom of the "Add orders from" page Then note the matched_biblionumber value. It should be populated correctly 1 - In acq, open a new basket, click Add To Basket, select From a New File 2 - select and stage your marc file without checking for matches 3 - from the staging results page, click Add staged files to basket 4 - on addorderiso2709.pl, select your title, add price, select fund 5 - make sure the Matching dropdown at the top of the page is set to Do not look for matching records 6 - click Save 7 - select * from import_biblios, confirm matched_biblionumber is not null B/ Import again the same record, this time you will have to use the "Add order" link in the list of order (ie. not the "Save" button) Note the matched_biblionumber value. It should be populated correctly 1 - in Tools, stage your file without checking for matches, do not complete import 2 - in acq, click Add to Basket, select From a Staged File 3 - on the "Choose the file to add to the basket" page, click Add orders 4 - on addorderiso2709.pl, select your title, add price, select fund 5 - make sure the Matching dropdown at the top of the page is set to Do not look for matching records 6 - click Save 7 - select * from import_biblios, confirm matched_biblionumber is not null
Created attachment 116255 [details] [review] Bug 24469: Record biblionumber in import_biblio when adding to basket via file The column import_biblios.matched_biblionumber was not populated when an order is created from a staged file. Test plan: A/ Create a new order from a stage file. Use the "Save" button at the bottom of the "Add orders from" page Then note the matched_biblionumber value. It should be populated correctly B/ Import again the same record, this time you will have to use the "Add order" link in the list of order (ie. not the "Save" button) Note the matched_biblionumber value. It should be populated correctly Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Created attachment 116779 [details] [review] Bug 24469: Record biblionumber in import_biblio when adding to basket via file The column import_biblios.matched_biblionumber was not populated when an order is created from a staged file. Test plan: A/ Create a new order from a stage file. Use the "Save" button at the bottom of the "Add orders from" page Then note the matched_biblionumber value. It should be populated correctly B/ Import again the same record, this time you will have to use the "Add order" link in the list of order (ie. not the "Save" button) Note the matched_biblionumber value. It should be populated correctly Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Sarah Daviau <sdaviau@arlingtonva.us>
Please explain why we are adding $dbh to a script without SQL. We should have a very good reason to do so instead of adding a sub to ImportBatch. Which we could also test etc. This looks like a quick production fix.
Yes Marcel, it's a valid question. I decided to put those 2 lines in the controller to avoid C4::ImportBatch. Having a new subroutine there to update matched_biblionumber doesn't really make sense, however adjusting SetImportBatchStatus to update it sounds better (it's basically what's done in C4::ImportBatch when SetImportRecordStatus is called). Doing that is not trivial and will certainly introduce bugs, which I'd like to avoid. A simple batch seemed better to backport. (I am just a developer, I am not dealing with production instances)
Created attachment 116792 [details] [review] Bug 24469: Move the new queries to a dedicated ImportBatch subroutine
(In reply to Jonathan Druart from comment #17) > A simple batch seemed better to backport. Typo! A simple *patch* :D
+ SetMatchedBiblionumber( $biblio->{import_record_id}, $biblionumber ); No compiler warning, but not exported in module?
Created attachment 116813 [details] [review] Bug 24469: Move the new queries to a dedicated ImportBatch subroutine
Amanded the patch with: @ C4/ImportBatch.pm:81 @ BEGIN { SetImportRecordOverlayStatus GetImportRecordStatus SetImportRecordStatus + SetMatchedBiblionumber GetImportRecordMatches SetImportRecordMatches );
Created attachment 116975 [details] [review] Bug 24469: Record biblionumber in import_biblio when adding to basket via file The column import_biblios.matched_biblionumber was not populated when an order is created from a staged file. Test plan: A/ Create a new order from a stage file. Use the "Save" button at the bottom of the "Add orders from" page Then note the matched_biblionumber value. It should be populated correctly B/ Import again the same record, this time you will have to use the "Add order" link in the list of order (ie. not the "Save" button) Note the matched_biblionumber value. It should be populated correctly Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Sarah Daviau <sdaviau@arlingtonva.us> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 116976 [details] [review] Bug 24469: Move the new queries to a dedicated ImportBatch subroutine Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Amended: POD line for $import_record_id.
SO+QA in one pass
Pushed to master for 21.05, thanks to everybody involved!
Pushed to 20.11.x for 20.11.03
After we upgraded Koha to version 20.05.09 we get Internal Server Error when importing a post to a basket. Here's output from the log file: ``` Undefined subroutine &CGI::Compile::ROOT::usr_share_koha_intranet_cgi_2dbin_acqui_neworderempty_2epl::SetMatchedBiblionumber called at /usr/share/koha/intranet/cgi-bin/acqui/neworderempty.pl line 183. ``` Could it be related to the fix for this bug report?
The patches are indeed part of 20.05.09. I don't recreate the problem on master however.
I do recreate on master!
(In reply to Jonathan Druart from comment #30) > I do recreate on master! See bug 27828. (In reply to Jonathan Druart from comment #17) > Doing that is not trivial and will certainly introduce bugs, which I'd like > to avoid. A simple batch seemed better to backport. Indeed...
Update to the ticket to reflect that it has been backported to 20.05
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.