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

(-)a/misc/migration_tools/bulkmarcimport.pl (-6 / +14 lines)
Lines 75-80 my $framework = ''; Link Here
75
my $localcust;
75
my $localcust;
76
my $marc_mod_template    = '';
76
my $marc_mod_template    = '';
77
my $marc_mod_template_id = -1;
77
my $marc_mod_template_id = -1;
78
my $skip_indexing        = 0;
78
$| = 1;
79
$| = 1;
79
80
80
GetOptions(
81
GetOptions(
Lines 111-116 GetOptions( Link Here
111
    'framework=s'       => \$framework,
112
    'framework=s'       => \$framework,
112
    'custom:s'          => \$localcust,
113
    'custom:s'          => \$localcust,
113
    'marcmodtemplate:s' => \$marc_mod_template,
114
    'marcmodtemplate:s' => \$marc_mod_template,
115
    'si|skip_indexing'  => \$skip_indexing,
114
);
116
);
115
117
116
$biblios ||= !$authorities;
118
$biblios ||= !$authorities;
Lines 128-140 if ($all) { Link Here
128
my $using_elastic_search = ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' );
130
my $using_elastic_search = ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' );
129
my $mod_biblio_options   = {
131
my $mod_biblio_options   = {
130
    disable_autolink  => $using_elastic_search,
132
    disable_autolink  => $using_elastic_search,
131
    skip_record_index => $using_elastic_search,
133
    skip_record_index => $using_elastic_search || $skip_indexing,
132
    overlay_context   => { source => 'bulkmarcimport' }
134
    overlay_context   => { source => 'bulkmarcimport' }
133
};
135
};
134
my $add_biblio_options = {
136
my $add_biblio_options = {
135
    disable_autolink  => $using_elastic_search,
137
    disable_autolink  => $using_elastic_search,
136
    skip_record_index => $using_elastic_search
138
    skip_record_index => $using_elastic_search || $skip_indexing
137
};
139
};
140
my $mod_authority_options = { skip_record_index => $using_elastic_search || $skip_indexing };
141
my $add_authority_options = { skip_record_index => $using_elastic_search || $skip_indexing };
138
142
139
my @search_engine_record_ids;
143
my @search_engine_record_ids;
140
my @search_engine_records;
144
my @search_engine_records;
Lines 467-473 RECORD: foreach my $record ( @{$marc_records} ) { Link Here
467
            if ($matched_record_id) {
471
            if ($matched_record_id) {
468
                if ($update) {
472
                if ($update) {
469
                    ## Authority has an id and is in database: update
473
                    ## Authority has an id and is in database: update
470
                    eval { ($authid) = ModAuthority( $matched_record_id, $record, $authtypecode ) };
474
                    eval {
475
                        ($authid) = ModAuthority(
476
                            $matched_record_id, $record, $authtypecode,
477
                            $mod_authority_options,
478
                        );
479
                    };
471
                    if ($@) {
480
                    if ($@) {
472
                        warn "ERROR: Update authority $matched_record_id failed: $@\n";
481
                        warn "ERROR: Update authority $matched_record_id failed: $@\n";
473
                        printlog( { id => $matched_record_id, op => "update", status => "ERROR" } ) if ($logfile);
482
                        printlog( { id => $matched_record_id, op => "update", status => "ERROR" } ) if ($logfile);
Lines 487-493 RECORD: foreach my $record ( @{$marc_records} ) { Link Here
487
                }
496
                }
488
            } elsif ($insert) {
497
            } elsif ($insert) {
489
                ## An authid is defined but no authority in database: insert
498
                ## An authid is defined but no authority in database: insert
490
                eval { ($authid) = AddAuthority( $record, undef, $authtypecode ) };
499
                eval { ($authid) = AddAuthority( $record, undef, $authtypecode, $add_authority_options ); };
491
                if ($@) {
500
                if ($@) {
492
                    warn "ERROR: Insert authority $originalid failed: $@\n";
501
                    warn "ERROR: Insert authority $originalid failed: $@\n";
493
                    printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile);
502
                    printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile);
Lines 682-688 RECORD: foreach my $record ( @{$marc_records} ) { Link Here
682
            $schema->txn_commit;
691
            $schema->txn_commit;
683
            $schema->txn_begin;
692
            $schema->txn_begin;
684
            if ($indexer) {
693
            if ($indexer) {
685
                $indexer->update_index( \@search_engine_record_ids, \@search_engine_records );
694
                $indexer->update_index( \@search_engine_record_ids, \@search_engine_records ) unless $skip_indexing;
686
                if ( C4::Context->preference('AutoLinkBiblios') ) {
695
                if ( C4::Context->preference('AutoLinkBiblios') ) {
687
                    foreach my $record (@search_engine_records) {
696
                    foreach my $record (@search_engine_records) {
688
                        BiblioAutoLink( $record, $framework );
697
                        BiblioAutoLink( $record, $framework );
689
- 

Return to bug 35466