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

(-)a/C4/Biblio.pm (-5 / +1 lines)
Lines 190-198 The C<$options> argument is a hashref with additional parameters: Link Here
190
190
191
=over 4
191
=over 4
192
192
193
=item B<defer_marc_save>
194
Used when ModBiblioMarc is handled by the caller
195
196
=item B<skip_record_index>
193
=item B<skip_record_index>
197
Used when the indexing scheduling will be handled by the caller
194
Used when the indexing scheduling will be handled by the caller
198
195
Lines 211-217 sub AddBiblio { Link Here
211
208
212
    $options //= {};
209
    $options //= {};
213
    my $skip_record_index = $options->{'skip_record_index'} // 0;
210
    my $skip_record_index = $options->{'skip_record_index'} // 0;
214
    my $defer_marc_save = $options->{defer_marc_save} // 0;
215
    my $disable_autolink = $options->{disable_autolink} // 0;
211
    my $disable_autolink = $options->{disable_autolink} // 0;
216
212
217
    if (!$record) {
213
    if (!$record) {
Lines 297-303 sub AddBiblio { Link Here
297
            }
293
            }
298
294
299
            # now add the record, don't index while we are in the transaction though
295
            # now add the record, don't index while we are in the transaction though
300
            ModBiblioMarc( $record, $biblionumber, { skip_record_index => 1 } ) unless $defer_marc_save;
296
            ModBiblioMarc( $record, $biblionumber, { skip_record_index => 1 } );
301
297
302
            # update OAI-PMH sets
298
            # update OAI-PMH sets
303
            if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) {
299
            if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) {
(-)a/misc/migration_tools/bulkmarcimport.pl (-13 / +1 lines)
Lines 542-548 RECORD: foreach my $record (@{$marc_records}) { Link Here
542
                }
542
                }
543
            }
543
            }
544
            elsif ($insert) {
544
            elsif ($insert) {
545
                eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework, { disable_autolink => 1, defer_marc_save => 1 }) };
545
                eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework, { disable_autolink => 1 }) };
546
                if ($@) {
546
                if ($@) {
547
                    warn "ERROR: Insert biblio $originalid failed: $@\n";
547
                    warn "ERROR: Insert biblio $originalid failed: $@\n";
548
                    printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile);
548
                    printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile);
Lines 564-576 RECORD: foreach my $record (@{$marc_records}) { Link Here
564
                my $error_adding = $@;
564
                my $error_adding = $@;
565
                $record_has_added_items = @{$itemnumbers_ref};
565
                $record_has_added_items = @{$itemnumbers_ref};
566
566
567
                # Work on a clone so that if there are real errors, we can maybe
568
                # fix them up later.
569
                my $clone_record = $record->clone();
570
                C4::Biblio::_strip_item_fields($clone_record, $framework);
571
                # This sets the marc fields if there was an error, and also calls
572
                # defer_marc_save.
573
                ModBiblioMarc($clone_record, $record_id, $mod_biblio_options);
574
                if ($error_adding) {
567
                if ($error_adding) {
575
                    warn "ERROR: Adding items to bib $record_id failed: $error_adding";
568
                    warn "ERROR: Adding items to bib $record_id failed: $error_adding";
576
                    printlog({ id => $record_id, op => "insert items", status => "ERROR"}) if ($logfile);
569
                    printlog({ id => $record_id, op => "insert items", status => "ERROR"}) if ($logfile);
Lines 615-624 RECORD: foreach my $record (@{$marc_records}) { Link Here
615
                        printlog({ id => $record_id, op => "insert items", status => "ERROR" }) if ($logfile);
608
                        printlog({ id => $record_id, op => "insert items", status => "ERROR" }) if ($logfile);
616
                        # if we failed because of an exception, assume that
609
                        # if we failed because of an exception, assume that
617
                        # the MARC columns in biblioitems were not set.
610
                        # the MARC columns in biblioitems were not set.
618
619
                        # @FIXME: Why do we save here without stripping items? Besides,
620
                        # save with stripped items has already been performed
621
                        ModBiblioMarc($record, $record_id, $mod_biblio_options);
622
                        next RECORD;
611
                        next RECORD;
623
                    }
612
                    }
624
                    $record_has_added_items ||= @{$itemnumbers_ref};
613
                    $record_has_added_items ||= @{$itemnumbers_ref};
625
- 

Return to bug 25539