In C4::ImportBatch::BatchCommitItems we attempt to store the error 'duplicate item barcode' in the 'itemnumber' column of import_items This fails To recreate: 1 - Export a record with items from the catalog 2 - Stage the record for import 3 - Import the batch 4 - Silent failure? Batch stuck in 'importing 5 - Bonus points/QA team, otherwise skip: Stage again, go to manage batch, before clicking 'Import this batch' a - Right click and inspect the submit button b - Scroll to <form> element c - Right click and 'Edit as HTML' d - Add '?runinbackground=0' to form action e - Delete the hidden input for 'runinbackground' a few lines down f - Click 'Import' g - Error: [Mon May 23 10:47:43.583448 2022] [cgi:error] [pid 3114] [client 172.18.0.1:60936] AH01215: C4::ImportBatch::BatchCommitItems(): DBI Exception: DBD::mysql::st execute failed: Incorrect integer value: 'duplicate item barcode' for column `koha_kohadev`.`import_items`.`itemnumber` at row 1 at /kohadevbox/koha/C4/ImportBatch.pm line 652: /kohadevbox/koha/tools/manage-marc-import.pl, referer: http://localhost:8081/cgi-bin/koha/tools/manage-marc-import.pl?import_batch_id=2
Created attachment 135260 [details] [review] Bug 30831: Unit test
Created attachment 135262 [details] [review] Bug 30831: Store error in import_error column To test: 1 - Export a record with items from the catalog 2 - Stage the record for import 3 - Import the batch 4 - Silent failure? Batch stuck in 'importing 5 - Bonus points/QA team, otherwise skip: Stage again, go to manage batch, before clicking 'Import this batch' a - Right click and inspect the submit button b - Scroll to <form> element c - Right click and 'Edit as HTML' d - Add '?runinbackground=0' to form action e - Delete the hidden input for 'runinbackground' a few lines down f - Click 'Import' g - Error: [Mon May 23 10:47:43.583448 2022] [cgi:error] [pid 3114] [client 172.18.0.1:60936] AH01215: C4::ImportBatch::BatchCommitItems(): DBI Exception: DBD::mysql::st execute failed: Incorrect integer value: 'duplicate item barcode' for column `koha_kohadev`.`import_items`.`itemnumber` at row 1 at /kohadevbox/koha/C4/ImportBatch.pm line 652: /kohadevbox/koha/tools/manage-marc-import.pl, referer: http://localhost:8081/cgi-bin/koha/tools/manage-marc-import.pl?import_batch_id=2 6 - Apply patch 7 - Stage and import record again 8 - Import success! 9 - Note results report 'Number of items ignored because of duplicate barcode' equal to number of items on record
I am pretty sure I talked about this issue on a bug with Joubu and that there was a patch, but I can't find it :(
(In reply to Katrin Fischer from comment #3) > I am pretty sure I talked about this issue on a bug with Joubu and that > there was a patch, but I can't find it :( Bug 28152 - SO, but no unit tests, otherwise essentially the same patch
(In reply to Nick Clemens from comment #4) > (In reply to Katrin Fischer from comment #3) > > I am pretty sure I talked about this issue on a bug with Joubu and that > > there was a patch, but I can't find it :( > > Bug 28152 - SO, but no unit tests, otherwise essentially the same patch PQA on that one,just a unit test here now
Created attachment 135280 [details] [review] Bug 30831: Unit test Signed-off-by: David Nind <david@davidnind.com>
Testing notes: - Ran prove t/db_dependent/ImportBatch.t before and after applying the patch: tests passed - After applying the patch (including dependencies) the import now works!
Created attachment 135297 [details] [review] Bug 30831: Unit test Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
PQA
Pushed to master for 22.11, thanks!
Pushed to 22.05.x for 22.05.01
pushed to 21.11.x for 21.11.07, thx!
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.