View | Details | Raw Unified | Return to bug 30465
Collapse All | Expand All

(-)a/C4/Biblio.pm (-4 / +10 lines)
Lines 351-357 Returns 1 on success 0 on failure Link Here
351
351
352
sub ModBiblio {
352
sub ModBiblio {
353
    my ( $record, $biblionumber, $frameworkcode, $options ) = @_;
353
    my ( $record, $biblionumber, $frameworkcode, $options ) = @_;
354
354
    $options //= {};
355
    $options //= {};
356
    my $skip_record_index = $options->{skip_record_index} || 0;
355
357
356
    if (!$record) {
358
    if (!$record) {
357
        carp 'No record passed to ModBiblio';
359
        carp 'No record passed to ModBiblio';
Lines 415-421 sub ModBiblio { Link Here
415
    _koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode );
417
    _koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode );
416
418
417
    # update the MARC record (that now contains biblio and items) with the new record data
419
    # update the MARC record (that now contains biblio and items) with the new record data
418
    ModBiblioMarc( $record, $biblionumber );
420
    ModBiblioMarc( $record, $biblionumber, { skip_record_index => $skip_record_index } );
419
421
420
    # modify the other koha tables
422
    # modify the other koha tables
421
    _koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode );
423
    _koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode );
Lines 2852-2863 Function exported, but should NOT be used, unless you really know what you're do Link Here
2852
sub ModBiblioMarc {
2854
sub ModBiblioMarc {
2853
    # pass the MARC::Record to this function, and it will create the records in
2855
    # pass the MARC::Record to this function, and it will create the records in
2854
    # the marcxml field
2856
    # the marcxml field
2855
    my ( $record, $biblionumber ) = @_;
2857
    my ( $record, $biblionumber, $params ) = @_;
2856
    if ( !$record ) {
2858
    if ( !$record ) {
2857
        carp 'ModBiblioMarc passed an undefined record';
2859
        carp 'ModBiblioMarc passed an undefined record';
2858
        return;
2860
        return;
2859
    }
2861
    }
2860
2862
2863
    my $skip_record_index = $params->{skip_record_index} || 0;
2864
2861
    # Clone record as it gets modified
2865
    # Clone record as it gets modified
2862
    $record = $record->clone();
2866
    $record = $record->clone();
2863
    my $dbh    = C4::Context->dbh;
2867
    my $dbh    = C4::Context->dbh;
Lines 2917-2924 sub ModBiblioMarc { Link Here
2917
    $m_rs->metadata( $record->as_xml_record($encoding) );
2921
    $m_rs->metadata( $record->as_xml_record($encoding) );
2918
    $m_rs->store;
2922
    $m_rs->store;
2919
2923
2920
    my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
2924
    unless ( $skip_record_index ) {
2921
    $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" );
2925
        my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
2926
        $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" );
2927
    }
2922
2928
2923
    return $biblionumber;
2929
    return $biblionumber;
2924
}
2930
}
(-)a/Koha/BackgroundJob/BatchUpdateBiblio.pm (-1 / +7 lines)
Lines 20-25 use JSON qw( decode_json encode_json ); Link Here
20
20
21
use Koha::DateUtils qw( dt_from_string );
21
use Koha::DateUtils qw( dt_from_string );
22
use Koha::Virtualshelves;
22
use Koha::Virtualshelves;
23
use Koha::SearchEngine;
24
use Koha::SearchEngine::Indexer;
23
25
24
use C4::Context;
26
use C4::Context;
25
use C4::Biblio;
27
use C4::Biblio;
Lines 89-95 sub process { Link Here
89
            C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
91
            C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
90
            my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
92
            my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
91
            C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, {
93
            C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, {
92
                overlay_context => $args->{overlay_context},
94
                overlay_context   => $args->{overlay_context},
95
                skip_record_index => 1,
93
            });
96
            });
94
        };
97
        };
95
        if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well
98
        if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well
Lines 110-115 sub process { Link Here
110
        $self->progress( ++$job_progress )->store;
113
        $self->progress( ++$job_progress )->store;
111
    }
114
    }
112
115
116
    my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
117
    $indexer->index_records( \@record_ids, "specialUpdate", "biblioserver" );
118
113
    my $job_data = decode_json $self->data;
119
    my $job_data = decode_json $self->data;
114
    $job_data->{messages} = \@messages;
120
    $job_data->{messages} = \@messages;
115
    $job_data->{report} = $report;
121
    $job_data->{report} = $report;
(-)a/Koha/Items.pm (-6 / +6 lines)
Lines 353-363 sub batch_update { Link Here
353
            Koha::Items->search( { itemnumber => \@modified_itemnumbers } )
353
            Koha::Items->search( { itemnumber => \@modified_itemnumbers } )
354
                       ->get_column('biblionumber'));
354
                       ->get_column('biblionumber'));
355
355
356
        my $indexer = Koha::SearchEngine::Indexer->new(
356
        if ( @biblionumbers ) {
357
            { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
357
            my $indexer = Koha::SearchEngine::Indexer->new(
358
        $indexer->index_records( \@biblionumbers, 'specialUpdate',
358
                { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
359
            "biblioserver", undef )
359
360
          if @biblionumbers;
360
            $indexer->update_index( \@biblionumbers );
361
        }
361
    }
362
    }
362
363
363
    return ( { modified_itemnumbers => \@modified_itemnumbers, modified_fields => $modified_fields }, $self );
364
    return ( { modified_itemnumbers => \@modified_itemnumbers, modified_fields => $modified_fields }, $self );
364
- 

Return to bug 30465