Lines 478-486
sub ImportBreedingAuth {
Link Here
|
478 |
|
478 |
|
479 |
my $controlnumber = $marcrecord->field('001')->data; |
479 |
my $controlnumber = $marcrecord->field('001')->data; |
480 |
|
480 |
|
481 |
# Normalize the record so it doesn't have separated diacritics |
|
|
482 |
SetUTF8Flag($marcrecord); |
483 |
|
484 |
$searchbreeding->execute($controlnumber,$heading); |
481 |
$searchbreeding->execute($controlnumber,$heading); |
485 |
my ($breedingid) = $searchbreeding->fetchrow; |
482 |
my ($breedingid) = $searchbreeding->fetchrow; |
486 |
|
483 |
|
Lines 578-608
sub Z3950SearchAuth {
Link Here
|
578 |
for ($i = ($page-1)*20; $i < (($numresults < ($page*20)) ? $numresults : ($page*20)); $i++) { |
575 |
for ($i = ($page-1)*20; $i < (($numresults < ($page*20)) ? $numresults : ($page*20)); $i++) { |
579 |
my $rec = $oResult[$k]->record($i); |
576 |
my $rec = $oResult[$k]->record($i); |
580 |
if ($rec) { |
577 |
if ($rec) { |
|
|
578 |
my $marcdata = $rec->raw(); |
581 |
my $marcrecord; |
579 |
my $marcrecord; |
582 |
my $marcdata; |
|
|
583 |
$marcdata = $rec->raw(); |
584 |
|
585 |
my ($charset_result, $charset_errors); |
586 |
if( $servers[$k]->{servertype} eq 'sru' ) { |
580 |
if( $servers[$k]->{servertype} eq 'sru' ) { |
587 |
$marcrecord = MARC::Record->new_from_xml( $marcdata, 'UTF-8', $servers[$k]->{syntax} ); |
581 |
$marcrecord = eval { MARC::Record->new_from_xml( $marcdata, 'UTF-8', $servers[$k]->{syntax} ) }; |
588 |
$marcrecord->encoding('UTF-8'); |
582 |
if( !$marcrecord || $@ ) { |
|
|
583 |
_dump_conversion_error( $servers[$k]->{servername}, $marcdata, $@ ); |
584 |
next; # skip this one |
585 |
} |
589 |
} else { |
586 |
} else { |
|
|
587 |
my ($charset_result, $charset_errors); |
590 |
( $marcrecord, $charset_result, $charset_errors ) = MarcToUTF8Record( $marcdata, $marc_type, $encoding[$k] ); |
588 |
( $marcrecord, $charset_result, $charset_errors ) = MarcToUTF8Record( $marcdata, $marc_type, $encoding[$k] ); |
|
|
589 |
if( !$marcrecord || @$charset_errors ) { |
590 |
_dump_conversion_error( $servers[$k]->{servername}, $marcdata, $charset_result, $charset_errors ); |
591 |
next; # skip this one |
592 |
} |
591 |
} |
593 |
} |
592 |
my $heading; |
594 |
$marcrecord->encoding('UTF-8'); |
593 |
my $heading_authtype_code; |
595 |
SetUTF8Flag($marcrecord); |
594 |
$heading_authtype_code = GuessAuthTypeCode($marcrecord); |
|
|
595 |
next if ( not defined $heading_authtype_code ) ; |
596 |
|
596 |
|
597 |
$heading = GetAuthorizedHeading({ record => $marcrecord }); |
597 |
my $heading_authtype_code = GuessAuthTypeCode($marcrecord) or next; |
598 |
|
598 |
my $heading = GetAuthorizedHeading({ record => $marcrecord }); |
599 |
my $breedingid = ImportBreedingAuth( $marcrecord, $serverhost[$k], $encoding[$k], $heading ); |
599 |
my $breedingid = ImportBreedingAuth( $marcrecord, $serverhost[$k], 'UTF-8', $heading ); |
600 |
my %row_data; |
600 |
my %row_data; |
601 |
$row_data{server} = $servers[$k]->{'servername'}; |
601 |
$row_data{server} = $servers[$k]->{'servername'}; |
602 |
$row_data{breedingid} = $breedingid; |
602 |
$row_data{breedingid} = $breedingid; |
603 |
$row_data{heading} = $heading; |
603 |
$row_data{heading} = $heading; |
604 |
$row_data{authid} = $authid; |
604 |
$row_data{authid} = $authid; |
605 |
$row_data{heading_code} = $heading_authtype_code; |
605 |
$row_data{heading_code} = $heading_authtype_code; |
606 |
push( @breeding_loop, \%row_data ); |
606 |
push( @breeding_loop, \%row_data ); |
607 |
} |
607 |
} |
608 |
else { |
608 |
else { |
Lines 639-644
sub Z3950SearchAuth {
Link Here
|
639 |
); |
639 |
); |
640 |
} |
640 |
} |
641 |
|
641 |
|
|
|
642 |
sub _dump_conversion_error { |
643 |
require Data::Dumper; |
644 |
warn Data::Dumper->new([ 'Z3950SearchAuth conversion error', @_ ])->Indent(0)->Dump; |
645 |
} |
646 |
|
642 |
1; |
647 |
1; |
643 |
__END__ |
648 |
__END__ |
644 |
|
649 |
|
645 |
- |
|
|