Bug 42130: ERM - Index biblio when local title is created/updated

The indexation step has been removed by
  commit d2820f57d6
  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 <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2026-03-19 10:35:32 +01:00 committed by Lucas Gass
parent adf7b69858
commit 5dcec8b803
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 11 additions and 0 deletions

View File

@ -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 );
@ -95,6 +96,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);
my @extended_attributes =
@ -161,6 +167,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);
my @extended_attributes =
map { { 'id' => $_->{field_id}, 'value' => $_->{value} } } @{$extended_attributes};