Bug 25265: (follow-up) Don't index malformed records

This is analogous to 26522, we shoudl skip record that cannot be retrieved for indexing

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2020-09-23 18:57:26 +00:00 committed by Jonathan Druart
parent a690ba2b26
commit a7dde763dc
1 changed files with 6 additions and 2 deletions

View File

@ -300,15 +300,19 @@ sub index_records {
$biblionumbers = [$biblionumbers] if ref $biblionumbers ne 'ARRAY' && defined $biblionumbers;
$records = [$records] if ref $records ne 'ARRAY' && defined $records;
if ( $op eq 'specialUpdate' ) {
my $index_biblionumbers;
unless ($records) {
foreach my $biblionumber ( @$biblionumbers ){
my $record = C4::Biblio::GetMarcBiblio({
biblionumber => $biblionumber,
embed_items => 1 });
push @$records, $record;
if( $record ){
push @$records, $record;
push @$index_biblionumbers, $biblionumber;
}
}
}
$self->update_index_background( $biblionumbers, $records );
$self->update_index_background( $index_biblionumbers, $records ) if $index_biblionumbers && $records;
}
elsif ( $op eq 'recordDelete' ) {
$self->delete_index_background( $biblionumbers );