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 |
- |
|
|