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

(-)a/C4/Biblio.pm (-4 / +13 lines)
Lines 188-196 The C<$options> argument is a hashref with additional parameters: Link Here
188
188
189
=over 4
189
=over 4
190
190
191
=item B<defer_marc_save>: used when ModBiblioMarc is handled by the caller
191
=item B<defer_marc_save>
192
Used when ModBiblioMarc is handled by the caller
192
193
193
=item B<skip_record_index>: used when the indexing scheduling will be handled by the caller
194
=item B<skip_record_index>
195
Used when the indexing scheduling will be handled by the caller
196
197
=item C<disable_autolink>
198
199
Unless C<disable_autolink> is passed AddBiblio will link record headings
200
to authorities based on settings in the system preferences. This flag allows
201
us to not link records when the authority linker is saving modifications.
194
202
195
=back
203
=back
196
204
Lines 203-210 sub AddBiblio { Link Here
203
    $mod_biblio_marc_options = {
211
    $mod_biblio_marc_options = {
204
        skip_record_index => $options->{'skip_record_index'} // 0
212
        skip_record_index => $options->{'skip_record_index'} // 0
205
    };
213
    };
206
207
    my $defer_marc_save = $options->{defer_marc_save} // 0;
214
    my $defer_marc_save = $options->{defer_marc_save} // 0;
215
    my $disable_autolink = $options->{disable_autolink}} // 0;
208
216
209
    if (!$record) {
217
    if (!$record) {
210
        carp('AddBiblio called with undefined record');
218
        carp('AddBiblio called with undefined record');
Lines 285-291 sub AddBiblio { Link Here
285
            # update MARC subfield that stores biblioitems.cn_sort
293
            # update MARC subfield that stores biblioitems.cn_sort
286
            _koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode );
294
            _koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode );
287
295
288
            if (C4::Context->preference('AutoLinkBiblios')) {
296
            if (!$disable_autolink && C4::Context->preference('BiblioAddsAuthorities')) {
289
                BiblioAutoLink( $record, $frameworkcode );
297
                BiblioAutoLink( $record, $frameworkcode );
290
            }
298
            }
291
299
Lines 570-575 sub BiblioAutoLink { Link Here
570
    my $record        = shift;
578
    my $record        = shift;
571
    my $frameworkcode = shift;
579
    my $frameworkcode = shift;
572
    my $verbose = shift;
580
    my $verbose = shift;
581
573
    if (!$record) {
582
    if (!$record) {
574
        carp('Undefined record passed to BiblioAutoLink');
583
        carp('Undefined record passed to BiblioAutoLink');
575
        return 0;
584
        return 0;
(-)a/misc/migration_tools/bulkmarcimport.pl (-2 / +8 lines)
Lines 19-24 use C4::Biblio qw( Link Here
19
    ModBiblioMarc
19
    ModBiblioMarc
20
    GetFrameworkCode
20
    GetFrameworkCode
21
    GetMarcBiblio
21
    GetMarcBiblio
22
    BiblioAutoLink
22
);
23
);
23
use C4::Koha;
24
use C4::Koha;
24
use C4::Charset qw( MarcToUTF8Record SetUTF8Flag );
25
use C4::Charset qw( MarcToUTF8Record SetUTF8Flag );
Lines 125-130 if ($all) { Link Here
125
126
126
my $using_elastic_search = (C4::Context->preference('SearchEngine') eq 'Elasticsearch');
127
my $using_elastic_search = (C4::Context->preference('SearchEngine') eq 'Elasticsearch');
127
my $modify_biblio_marc_options = {
128
my $modify_biblio_marc_options = {
129
    disable_autolink => $using_elastic_search,
128
    defer_search_engine_indexing => $using_elastic_search,
130
    defer_search_engine_indexing => $using_elastic_search,
129
    overlay_context => { source => 'bulkmarcimport' }
131
    overlay_context => { source => 'bulkmarcimport' }
130
};
132
};
Lines 541-547 RECORD: foreach my $record (@{$marc_records}) { Link Here
541
                }
543
                }
542
            }
544
            }
543
            elsif ($insert) {
545
            elsif ($insert) {
544
                eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework, { defer_marc_save => 1 }) };
546
                eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework, { disable_autolink => 1, defer_marc_save => 1 }) };
545
                if ($@) {
547
                if ($@) {
546
                    warn "ERROR: Insert biblio $originalid failed: $@\n";
548
                    warn "ERROR: Insert biblio $originalid failed: $@\n";
547
                    printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile);
549
                    printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile);
Lines 645-650 RECORD: foreach my $record (@{$marc_records}) { Link Here
645
            $schema->txn_begin;
647
            $schema->txn_begin;
646
            if ($indexer) {
648
            if ($indexer) {
647
                $indexer->update_index(\@search_engine_record_ids, \@search_engine_records);
649
                $indexer->update_index(\@search_engine_record_ids, \@search_engine_records);
650
                if (C4::Context->preference('BiblioAddsAuthorities')) {
651
                    foreach my $record (@search_engine_records) {
652
                        BiblioAutoLink($record, $framework);
653
                    }
654
                }
648
                @search_engine_record_ids = ();
655
                @search_engine_record_ids = ();
649
                @search_engine_records = ();
656
                @search_engine_records = ();
650
            }
657
            }
651
- 

Return to bug 29440