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.