From 246882dd13ddb66c7c4ef6c243a75ca30cae7f14 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Tue, 4 Jun 2024 11:49:38 +0200 Subject: [PATCH] Bug 36372: trigger a record indexing when the record source is set Signed-off-by: Janusz Kaczmarek --- cataloguing/record_source.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cataloguing/record_source.pl b/cataloguing/record_source.pl index ffd141321b..883bf722ee 100644 --- a/cataloguing/record_source.pl +++ b/cataloguing/record_source.pl @@ -28,19 +28,23 @@ use C4::Context; use Koha::DateUtils qw( dt_from_string ); use Koha::Biblios; use Koha::RecordSources; +use Koha::SearchEngine; +use Koha::SearchEngine::Indexer; use URI::Escape qw( uri_escape_utf8 ); # ======================== # MAIN #========================= my $input = CGI->new; -my $biblionumber = $input->param('biblionumber'); # if biblionumber exists, it's a modif, not a new biblio. +my $biblionumber = $input->param('biblionumber'); my $record_source_id = $input->param('record_source_id') // ''; my $save = $input->param('save') // ''; -if ($save ne '') { +if ($save) { my $biblio = Koha::Biblios->find($biblionumber); $biblio->metadata->set({record_source_id => $record_source_id})->store; + my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); + $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" ); print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber"); } -- 2.39.2