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

(-)a/C4/Biblio.pm (-3 / +13 lines)
Lines 191-199 The C<$options> argument is a hashref with additional parameters: Link Here
191
191
192
=over 4
192
=over 4
193
193
194
=item B<defer_marc_save>: used when ModBiblioMarc is handled by the caller
194
=item B<defer_marc_save>
195
Used when ModBiblioMarc is handled by the caller
195
196
196
=item B<skip_record_index>: used when the indexing scheduling will be handled by the caller
197
=item B<skip_record_index>
198
Used when the indexing scheduling will be handled by the caller
199
200
=item C<disable_autolink>
201
202
Unless C<disable_autolink> is passed AddBiblio will link record headings
203
to authorities based on settings in the system preferences. This flag allows
204
us to not link records when the authority linker is saving modifications.
197
205
198
=back
206
=back
199
207
Lines 205-210 sub AddBiblio { Link Here
205
    $options //= {};
213
    $options //= {};
206
    my $skip_record_index = $options->{'skip_record_index'} // 0;
214
    my $skip_record_index = $options->{'skip_record_index'} // 0;
207
    my $defer_marc_save = $options->{defer_marc_save} // 0;
215
    my $defer_marc_save = $options->{defer_marc_save} // 0;
216
    my $disable_autolink = $options->{disable_autolink} // 0;
208
217
209
    if (!$record) {
218
    if (!$record) {
210
        carp('AddBiblio called with undefined record');
219
        carp('AddBiblio called with undefined record');
Lines 284-290 sub AddBiblio { Link Here
284
            # update MARC subfield that stores biblioitems.cn_sort
293
            # update MARC subfield that stores biblioitems.cn_sort
285
            _koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode );
294
            _koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode );
286
295
287
            if (C4::Context->preference('AutoLinkBiblios')) {
296
            if (!$disable_autolink && C4::Context->preference('BiblioAddsAuthorities')) {
288
                BiblioAutoLink( $record, $frameworkcode );
297
                BiblioAutoLink( $record, $frameworkcode );
289
            }
298
            }
290
299
Lines 590-595 sub BiblioAutoLink { Link Here
590
    my $record        = shift;
599
    my $record        = shift;
591
    my $frameworkcode = shift;
600
    my $frameworkcode = shift;
592
    my $verbose = shift;
601
    my $verbose = shift;
602
593
    if (!$record) {
603
    if (!$record) {
594
        carp('Undefined record passed to BiblioAutoLink');
604
        carp('Undefined record passed to BiblioAutoLink');
595
        return 0;
605
        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