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

(-)a/C4/Biblio.pm (-5 / +1 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>
192
Used when ModBiblioMarc is handled by the caller
193
194
=item B<skip_record_index>
191
=item B<skip_record_index>
195
Used when the indexing scheduling will be handled by the caller
192
Used when the indexing scheduling will be handled by the caller
196
193
Lines 211-217 sub AddBiblio { Link Here
211
    my $mod_biblio_marc_options = {
208
    my $mod_biblio_marc_options = {
212
        skip_record_index => $options->{'skip_record_index'} // 0
209
        skip_record_index => $options->{'skip_record_index'} // 0
213
    };
210
    };
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 298-304 sub AddBiblio { Link Here
298
            }
294
            }
299
295
300
            # now add the record
296
            # now add the record
301
            ModBiblioMarc( $record, $biblionumber, $mod_biblio_marc_options ) unless $defer_marc_save;
297
            ModBiblioMarc( $record, $biblionumber, $mod_biblio_marc_options );
302
298
303
            # update OAI-PMH sets
299
            # update OAI-PMH sets
304
            if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) {
300
            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