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

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