From 1dac2edcf61dc24551fc85c0aea24db747b8ce47 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 19 Mar 2026 10:35:32 +0100 Subject: [PATCH] Bug 42130: ERM - Index biblio when local title is created/updated The indexation step has been removed by commit d2820f57d6a738786a243e558e43ba640eaf7165 Bug 34788: (QA follow-up) Koha/ERM/EHoldings/Title.pm - C4::Biblio::ModBiblio( $record, $self->biblio_id, '' ); + C4::Biblio::ModBiblio( $record, $self->biblio_id, '', { skip_record_index => 1 } ); From the commit message: 2) The background job now uses skip_record_index to avoid queuing indexing jobs for every new biblio and instead queues one job at the end it's then missing when we add or edit a local title. Test plan: 1 - Enable ERMModule 2 - Go to ERM 3 - eHoldings->Titles 4 - New title 5 - Populate the form 6 - Check the create bibliographic record box 7 - Save => Confirm that the biblio is now indexed 8. Edit the title, modify a value, tick the box, save => Confirm that the biblio is now indexed with the new value Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Lucas Gass (cherry picked from commit 5dcec8b80389ed845800ed4c8192b3e1909debe1) Signed-off-by: Baptiste Wojtkowski Signed-off-by: Wainui Witika-Park --- Koha/REST/V1/ERM/EHoldings/Titles/Local.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm b/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm index 65a9b8d812..a94b609a74 100644 --- a/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm +++ b/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm @@ -22,6 +22,7 @@ use Mojo::Base 'Mojolicious::Controller'; use Koha::ERM::EHoldings::Titles; use Koha::BackgroundJob::CreateEHoldingsFromBiblios; use Koha::BackgroundJob::ImportKBARTFile; +use Koha::SearchEngine::Indexer; use Scalar::Util qw( blessed ); use Try::Tiny qw( catch try ); @@ -94,6 +95,11 @@ sub add { my $title = Koha::ERM::EHoldings::Title->new_from_api($body) ->store( { create_linked_biblio => $create_linked_biblio } ); + if ($create_linked_biblio) { + my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); + $indexer->index_records( $title->biblio_id, "specialUpdate", "biblioserver" ); + } + $title->resources($resources); $c->res->headers->location( $c->req->url->to_string . '/' . $title->title_id ); @@ -155,6 +161,11 @@ sub update { $title->set_from_api($body)->store( { create_linked_biblio => $create_linked_biblio } ); + if ($create_linked_biblio) { + my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); + $indexer->index_records( $title->biblio_id, "specialUpdate", "biblioserver" ); + } + $title->resources($resources); return $c->render(