https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43792 Bug ID: 43792 Summary: Staging/commit should honour LDR/5 = d (deleted) in incoming records Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: MARC Bibliographic record staging/import Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Target Milestone: --- MARC 21 defines leader position 05 ("record status") with the value 'd' meaning the record has been deleted. Sources of bibliographic data use this to tell consumers a record should be removed. For example, the National Library of Sweden's Libris MARC21 export API can mark deleted records this way (deleted=export). Koha does not act on this when importing. C4::ImportBatch and the staging code never read LDR/5, so a staged record with 'd' is matched and then added or overlaid like any other. If it overlays an existing record, it replaces the live record with a copy marked as deleted. The only existing handling is misc/cronjobs/delete_records_via_leader.pl (bug 11084). It runs after the fact, by a text search of stored MARCXML for 'd' at leader position 5. Integrations that want to keep a catalogue in sync therefore have to work around it. We currently split deleted IDs out of the export separately and delete them ourselves. Proposal Add an import profile option, along the lines of "Records with LDR/5 = d", with values: - Import as normal (the current behaviour, which stays the default) - Ignore these records - Delete the matched record For "delete the matched record": - Matching uses the profile's normal matching rule. - A 'd' record with no match is ignored, not added. - A matched record is only deleted when DelBiblio allows it, so one that still has items is reported and left alone. - The outcome appears in the batch report and is reversible by the usual "undo import" where possible. Related bugs - Bug 25465 asks for a "delete matched record" action for batches of deletion records. This would provide the same action, triggered by LDR/5. - Bug 42044 and bug 42039 (Koha::Util::MARC::update_record_status) make Koha write LDR/5 consistently. This is the consumer side, and could reuse that helper to read the status. - Bug 11084 and bug 42742 cover the existing cron script. Open questions 1. Should the option live in the import profile, on the batch, or both? 2. Should matched records with items be deleted when an option such as "delete items too" is chosen, as delete_records_via_leader.pl --delete-items does? 3. Authority records have the same convention (see bug 33609). Should this be limited to bibliographic records at first? Test plan 1. Create an import profile with a matching rule on 001 and the new option set to "Delete the matched record". 2. Create a bib with 001 = A and no items, one with 001 = B and an item, and stage a file containing records A, B and C (no match), each with LDR/5 = d. 3. Commit the batch. Expect A deleted, B kept and reported as having items, C ignored (not added). 4. Repeat with "Import as normal". Expect the old behaviour. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.