[Bug 42160] New: automatic_renewals.pl reindexes by itemnumber, should reindex by biblionumber
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42160 Bug ID: 42160 Summary: automatic_renewals.pl reindexes by itemnumber, should reindex by biblionumber Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: pasi.kallinen@koha-suomi.fi QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz automatic_renewals.pl does this: push @item_renewal_ids, $auto_renew->itemnumber; ... my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); $indexer->index_records( \@item_renewal_ids, "specialUpdate", "biblioserver" ); So, it is calling index_records with the itemnumbers to be indexed. Everywhere else similar calls to index_records use biblionumbers. -- 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=42160 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |adolfo.rodriguez@xercode.es |ity.org | Status|NEW |Needs Signoff --- Comment #1 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- cdb9f0b: Bug 42160: Reindex the renewed records once, by biblionumber, in automatic_renewals.pl -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42160 --- Comment #2 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 209148 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209148&action=edit Bug 42160: Reindex the renewed records once, by biblionumber, in automatic_renewals.pl automatic_renewals.pl collects the renewed checkouts to reindex their records once at the end (bug 32013), but: - it collects itemnumbers and passes them to index_records, which expects biblionumbers, so it reindexes unrelated records (or none) - attempt_auto_renew calls AddRenewal without skip_record_index, so every renewal still enqueues its own reindex This patch adds a skip_record_index parameter to Koha::Checkout->attempt_auto_renew, passed to AddRenewal, and automatic_renewals.pl uses it and collects the biblionumbers of the renewed items, without duplicates, to reindex them in a single call. Steps to follow: 1. Set up two or three automatic renewals that can be renewed now, including two items of the same record. For example: - a circulation rule with "Automatic renewal" = Yes, renewals allowed and no "No automatic renewal before" - check out the items to a patron with "Automatic renewal of checkouts" = Yes, with a due date in the past - set OverduesBlockRenewing to "Allow renewing" 2. Note the last background job id: SELECT MAX(id) FROM background_jobs; 3. Run misc/cronjobs/automatic_renewals.pl -c -v: the checkouts are renewed. 4. Check the reindex jobs enqueued: SELECT id, queue, data FROM background_jobs WHERE id > <id of step 2>; There is one job per renewal, and one more job whose record_ids are the itemnumbers of the renewed items. 5. Apply the patch, set the checkouts due in the past again and repeat steps 2-4: there is a single job, whose record_ids are the biblionumbers of the renewed items, without duplicates. 6. prove t/db_dependent/Koha/Checkouts.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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42160 --- Comment #3 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Hello, the patch also fixes a second problem: Koha::Checkout->attempt_auto_renew calls AddRenewal without skip_record_index, so every renewal enqueued its own reindex, and the single reindex at the end of the script (bug 32013) never replaced them. Fixing only the itemnumbers would have reindexed each record twice. Now the renewals skip the reindex, and the script reindexes the biblionumbers of all the renewed items, without duplicates, in a single call. Tested with 3 automatic renewals (2 of them on the same record): before the patch, 4 jobs (one per renewal, plus one with the itemnumbers); after, 1 job with the 2 biblionumbers. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org