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