https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44348 --- Comment #1 from Andrii Nugged <nugged@gmail.com> --- Created attachment 212856 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212856&action=edit Bug 44348: Finish a MARC import when retrying a partial batch BatchCommitRecords opens a transaction for each record, then skips records already imported or marked as errors. Each skip leaves an open transaction, so later records and the job status are rolled back when the worker exits. Start the transaction after deciding whether to skip a record. The regression test checks that retrying a batch preserves transaction depth and imports the pending record while skipping prior work. Test plan: Use a test instance and the attached three-record MARC fixture. The second item's library is NOPE. Use a fresh fixture or database in each phase and ensure that NOPE does not exist before staging. Before applying the patch: 1. Open Cataloging > Stage records for import. 2. Stage the attached file with "Always add items" and no match rule. 3. Open the batch in Manage staged MARC records. 4. Click "Import this batch into the catalog". 5. Open the job details and wait for Failed. 6. Open Administration > Libraries. 7. Add a library with the code NOPE. 8. Return to the same batch in Manage staged MARC records. 9. Click "Import this batch into the catalog" again. 10. Open the new job details. The status remains Started at 0 / 3. 11. Reopen the batch. It is Staged, with one record in the catalog. Apply the patch. After applying the patch: 1. Repeat the workflow with a fresh test database and batch. 2. Verify that the second job shows Finished at 3 / 3. 3. Reopen the batch. It is Imported, with three records and items in the catalog. Co-Authored-By: Loontik <loontik@nugged.team> -- You are receiving this mail because: You are watching all bug changes.