[Bug 43905] New: Staged MARC import: replacing an item attached to another record does not reindex that record
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43905 Bug ID: 43905 Summary: Staged MARC import: replacing an item attached to another record does not reindex that record Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal 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 Target Milestone: --- When a staged MARC import is committed with the item action "replace", _batchCommitItems looks for the existing item by itemnumber (952$9) or by barcode and updates it with ModItemFromMarc, using skip_record_index. That item can be attached to a different record than the one being imported (the code keeps it where it is: "We assume that when replacing items we do not want to move them"). At the end, BatchCommitRecords only reindexes the imported records, so the record the replaced item belongs to is not reindexed, and the search results keep showing the old item data (for example, the old call number). The holds queue is not updated for that record either. To reproduce: 1. Take a record A with an item with barcode X. 2. Stage a file with a record that matches another record B (for example by ISBN), with a 952 with barcode X and a different call number. Use the ISBN matching rule, "Ignore incoming record" if a match is found, and "Replace items if matching bib was found". 3. Import the batch: the item is updated in the database, but the search results still show the old call number for record A. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43905 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43905 --- Comment #1 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 208965 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208965&action=edit Bug 43905: Reindex the record of the items replaced by a staged MARC import When a staged MARC import replaces an item (item action "replace"), the item stays attached to its record, which can be a different one than the imported record. BatchCommitRecords only reindexed the imported records, so the search results kept showing the old data of the replaced item. This patch makes _batchCommitItems also return the records of the replaced items that are attached to another record, and BatchCommitRecords adds them to the records to reindex and to the holds queue update, without duplicates. Steps to follow: 1. Make sure the search index is updated automatically (koha-es-indexer running, or the Zebra daemon) and that the background jobs worker is running. 2. Choose an item of a record A, note its barcode and call number, and choose another record B with an ISBN. 3. Create a MARC file with a record that has the ISBN of record B in 020$a, and a 952 with the barcode of the item of record A and a new call number in 952$o (and 952$a, $b and $y). 4. Tools > Stage records for import: stage the file with: - Record matching rule: ISBN - Action if matching record found: Ignore incoming record - Action if no match is found: Ignore incoming record - How to process items: Replace items if matching bib was found and import the batch: 1 item is replaced. 5. The item has the new call number in the database (record A, Edit items), but the search results still show the old one for record A. 6. Restore the call number of the item, apply the patch, restart_all (or restart Plack and the background jobs worker) and repeat steps 4 and 5: now the search results show the new call number for record A. 7. prove t/db_dependent/ImportBatch.t Signed-off-by: Adolfo Rodríguez <adolfo.rodriguez@xercode.es> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43905 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |adolfo.rodriguez@xercode.es |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43905 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208965|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43905 --- Comment #2 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 208974 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208974&action=edit Bug 43905: Reindex the record of the items replaced by a staged MARC import When a staged MARC import replaces an item (item action "replace"), the item stays attached to its record, which can be a different one than the imported record. BatchCommitRecords only reindexed the imported records, so the search results kept showing the old data of the replaced item. This patch makes _batchCommitItems also return the records of the replaced items that are attached to another record, and BatchCommitRecords adds them to the records to reindex and to the holds queue update, without duplicates. Steps to follow: 1. Make sure the search index is updated automatically (koha-es-indexer running, or the Zebra daemon) and that the background jobs worker is running. 2. Choose an item of a record A, note its barcode and call number, and choose another record B with an ISBN. 3. Create a MARC file with a record that has the ISBN of record B in 020$a, and a 952 with the barcode of the item of record A and a new call number in 952$o (and 952$a, $b and $y). 4. Cataloging > Stage records for import: stage the file with: - Record matching rule: ISBN - Action if matching record found: Ignore incoming record - Action if no match is found: Ignore incoming record - How to process items: Replace items if matching bib was found and import the batch (Cataloging > Manage staged records > Import this batch into the catalog): 1 item is replaced. 5. The item has the new call number in the database (record A, Edit items), but the search results still show the old one for record A. 6. Restore the call number of the item, apply the patch, restart_all (or restart Plack and the background jobs worker) and repeat steps 4 and 5: now the search results show the new call number for record A. 7. prove t/db_dependent/ImportBatch.t Signed-off-by: Adolfo Rodríguez <adolfo.rodriguez@xercode.es> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org