|
Lines 287-293
RECORD: while ( ) {
Link Here
|
| 287 |
($record, $guessed_charset, $charset_errors) = MarcToUTF8Record($record, $marcFlavour.(($authorities and $marcFlavour ne "MARC21")?'AUTH':'')); |
287 |
($record, $guessed_charset, $charset_errors) = MarcToUTF8Record($record, $marcFlavour.(($authorities and $marcFlavour ne "MARC21")?'AUTH':'')); |
| 288 |
if ($guessed_charset eq 'failed') { |
288 |
if ($guessed_charset eq 'failed') { |
| 289 |
warn "ERROR: failed to perform character conversion for record $i\n"; |
289 |
warn "ERROR: failed to perform character conversion for record $i\n"; |
| 290 |
next RECORD; |
290 |
next RECORD; |
| 291 |
} |
291 |
} |
| 292 |
} |
292 |
} |
| 293 |
SetUTF8Flag($record); |
293 |
SetUTF8Flag($record); |
|
Lines 396-402
RECORD: while ( ) {
Link Here
|
| 396 |
else{ |
396 |
else{ |
| 397 |
printlog({id=>$originalid||$id||$authid, op=>"edit",status=>"ok"}) if ($logfile); |
397 |
printlog({id=>$originalid||$id||$authid, op=>"edit",status=>"ok"}) if ($logfile); |
| 398 |
} |
398 |
} |
| 399 |
} |
399 |
} |
| 400 |
elsif (defined $authid) { |
400 |
elsif (defined $authid) { |
| 401 |
## An authid is defined but no authority in database : add |
401 |
## An authid is defined but no authority in database : add |
| 402 |
eval { ( $authid ) = AddAuthority($record,$authid, $authtypecode) }; |
402 |
eval { ( $authid ) = AddAuthority($record,$authid, $authtypecode) }; |
|
Lines 468-474
RECORD: while ( ) {
Link Here
|
| 468 |
} |
468 |
} |
| 469 |
} else { |
469 |
} else { |
| 470 |
if ($insert) { |
470 |
if ($insert) { |
| 471 |
eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '', { defer_marc_save => 1 } ) }; |
471 |
eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '') }; |
| 472 |
if ($@) { |
472 |
if ($@) { |
| 473 |
warn "ERROR: Adding biblio $biblionumber failed: $@\n"; |
473 |
warn "ERROR: Adding biblio $biblionumber failed: $@\n"; |
| 474 |
printlog( { id => $id || $originalid || $biblionumber, op => "insert", status => "ERROR" } ) if ($logfile); |
474 |
printlog( { id => $id || $originalid || $biblionumber, op => "insert", status => "ERROR" } ) if ($logfile); |
|
Lines 484-500
RECORD: while ( ) {
Link Here
|
| 484 |
} |
484 |
} |
| 485 |
eval { ( $itemnumbers_ref, $errors_ref ) = AddItemBatchFromMarc( $record, $biblionumber, $biblioitemnumber, '' ); }; |
485 |
eval { ( $itemnumbers_ref, $errors_ref ) = AddItemBatchFromMarc( $record, $biblionumber, $biblioitemnumber, '' ); }; |
| 486 |
my $error_adding = $@; |
486 |
my $error_adding = $@; |
| 487 |
# Work on a clone so that if there are real errors, we can maybe |
|
|
| 488 |
# fix them up later. |
| 489 |
my $clone_record = $record->clone(); |
| 490 |
C4::Biblio::_strip_item_fields($clone_record, ''); |
| 491 |
# This sets the marc fields if there was an error, and also calls |
| 492 |
# defer_marc_save. |
| 493 |
ModBiblioMarc( $clone_record, $biblionumber, $framework ); |
| 494 |
if ( $error_adding ) { |
487 |
if ( $error_adding ) { |
| 495 |
warn "ERROR: Adding items to bib $biblionumber failed: $error_adding"; |
488 |
warn "ERROR: Adding items to bib $biblionumber failed: $error_adding"; |
| 496 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile); |
489 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile); |
| 497 |
# if we failed because of an exception, assume that |
490 |
# if we failed because of an exception, assume that |
| 498 |
# the MARC columns in biblioitems were not set. |
491 |
# the MARC columns in biblioitems were not set. |
| 499 |
next RECORD; |
492 |
next RECORD; |
| 500 |
} |
493 |
} |
|
Lines 534-542
RECORD: while ( ) {
Link Here
|
| 534 |
if ( $@ ) { |
527 |
if ( $@ ) { |
| 535 |
warn "ERROR: Adding items to bib $biblionumber failed: $@\n"; |
528 |
warn "ERROR: Adding items to bib $biblionumber failed: $@\n"; |
| 536 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile); |
529 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile); |
| 537 |
# if we failed because of an exception, assume that |
|
|
| 538 |
# the MARC columns in biblioitems were not set. |
| 539 |
ModBiblioMarc( $record, $biblionumber, $framework ); |
| 540 |
next RECORD; |
530 |
next RECORD; |
| 541 |
} else { |
531 |
} else { |
| 542 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ok"}) if ($logfile); |
532 |
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ok"}) if ($logfile); |
|
Lines 585-591
sub GetRecordId{
Link Here
|
| 585 |
my $id; |
575 |
my $id; |
| 586 |
if ($tag lt "010"){ |
576 |
if ($tag lt "010"){ |
| 587 |
return $marcrecord->field($tag)->data() if $marcrecord->field($tag); |
577 |
return $marcrecord->field($tag)->data() if $marcrecord->field($tag); |
| 588 |
} |
578 |
} |
| 589 |
elsif ($subfield){ |
579 |
elsif ($subfield){ |
| 590 |
if ($marcrecord->field($tag)){ |
580 |
if ($marcrecord->field($tag)){ |
| 591 |
return $marcrecord->subfield($tag,$subfield); |
581 |
return $marcrecord->subfield($tag,$subfield); |
| 592 |
- |
|
|