https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37564

--- Comment #18 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 200729
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200729&action=edit
Bug 37564: Prevent bulkmarcimport from generating holds queue jobs

When importing records from the command line we do not always need to
rebuild the holds queue.

Adding a brand new biblio and its items cannot affect the holds queue,
as there can be no holds against a record that did not previously exist,
so the rebuild can be skipped entirely.

When an existing record is matched and updated, however, the queue does
need rebuilding as we (re)add the items, because holds may already exist
against that record.

To support this, AddItemBatchFromMarc now accepts an options hashref and
passes a skip_holds_queue flag down to Koha::Item->store. bulkmarcimport
sets the flag per record: skipping the rebuild on insert and allowing it
on update. The biblio level options also skip the holds queue, as any
required rebuild is driven by the item additions.

Test plan (using KTD):
 1. Enable the real time holds queue: RealTimeHoldsQueue = Enable
 2. Delete any existing background jobs:
      DELETE FROM background_jobs;
 3. Count the holds queue jobs (should be 0):
      SELECT COUNT(*) FROM background_jobs
       WHERE type = 'update_holds_queue_for_biblios';
 4. Export a record that has at least one item as MARCXML from Koha.
 5. Delete the exported record from Koha.
 6. Import the record with bulkmarcimport.pl (insert is the default):
      misc/migration_tools/bulkmarcimport.pl -b -v -m=MARCXML \
        --file my_record.marcxml
 7. Re-run the query from step 3: there is one job per item imported.
 8. Delete the imported record again.
 9. Clear the background jobs again (see step 2).
10. Apply this patch.
11. Import the record again (see step 6).
12. Re-run the query from step 3: the count is now 0, because the record
    is new and cannot have holds.
13. Clear the background jobs again, then import the record once more,
    this time matching and *updating* the existing record so its items
    are re-added. The --update flag is required: without it a matched
    record is skipped and no items are added (this is why no jobs
    appeared in earlier testing). Make sure the record from step 11 has
    finished indexing so it can be matched:
      misc/migration_tools/bulkmarcimport.pl -b -v -m=MARCXML --update \
        --match=isbn,020a --file my_record.marcxml
14. Re-run the query from step 3: there is one job per item, because the
    items were added to an existing record that may have holds.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to