https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43907 Bug ID: 43907 Summary: Reverting a staged MARC import deletes the existing items that the import replaced Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: MARC Bibliographic record staging/import Assignee: koha-bugs@lists.koha-community.org Reporter: adolfo.rodriguez@xercode.es QA Contact: testopia@bugs.koha-community.org Depends on: 43905 Target Milestone: --- When a staged MARC import is committed with the item action "replace", existing items are replaced: the item is found by its itemnumber (952$9) or by its barcode, and updated. These items already existed before the import, and can be attached to another record. Reverting the batch then deletes the items listed in import_items for each record, but import_items does not distinguish the replaced items from the items created by the import (both have the status 'imported'): - If the item was matched by itemnumber, import_items.itemnumber is the existing item, so reverting the batch DELETES THAT EXISTING ITEM. - If the item was matched by barcode, import_items.itemnumber gets the 952$9 of the incoming file (usually empty) instead of the replaced item, so the item is not deleted, but the link is wrong (and it could point to an unrelated item). To reproduce: 1. Cataloging > Stage records for import: stage a file with a record that matches an existing record (for example by ISBN), with a 952 with the itemnumber (952$9) of an existing item of any record, choosing "Replace items if matching bib was found". 2. Cataloging > Manage staged records: import the batch. 1 item is replaced. 3. Undo the import of the batch: the existing item is deleted (it is now in deleteditems). Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43905 [Bug 43905] Staged MARC import: replacing an item attached to another record does not reindex that record -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.