|
Lines 542-557
sub LinkBibHeadingsToAuthorities {
Link Here
|
| 542 |
} |
542 |
} |
| 543 |
$field->delete_subfield( code => '9' ) |
543 |
$field->delete_subfield( code => '9' ) |
| 544 |
if defined $current_link; |
544 |
if defined $current_link; |
| 545 |
my $authfield = |
545 |
my @auth_subfields; |
| 546 |
MARC::Field->new( $authority_type->auth_tag_to_report, |
546 |
foreach my $subfield ( $field->subfields() ){ |
| 547 |
'', '', "a" => "" . $field->subfield('a') ); |
547 |
if ( $subfield->[0] =~ /[A-z]/ |
| 548 |
map { |
|
|
| 549 |
$authfield->add_subfields( $_->[0] => $_->[1] ) |
| 550 |
if ( $_->[0] =~ /[A-z]/ && $_->[0] ne "a" |
| 551 |
&& C4::Heading::valid_bib_heading_subfield( |
548 |
&& C4::Heading::valid_bib_heading_subfield( |
| 552 |
$field->tag, $_->[0] ) |
549 |
$field->tag, $subfield->[0] ) |
| 553 |
); |
550 |
){ |
| 554 |
} $field->subfields(); |
551 |
push @auth_subfields, $subfield->[0] => $subfield->[1]; |
|
|
552 |
} |
| 553 |
} |
| 554 |
# Bib headings contain some ending punctuation that should NOT |
| 555 |
# be included in the authority record. Strip those before creation |
| 556 |
next unless @auth_subfields; # Don't try to create a record if we have no fields; |
| 557 |
my $last_sub = pop @auth_subfields; |
| 558 |
$last_sub =~ s/[\s]*[,.:=;!%\/][\s]*$//; |
| 559 |
push @auth_subfields, $last_sub; |
| 560 |
my $authfield = MARC::Field->new( $authority_type->auth_tag_to_report, '', '', @auth_subfields ); |
| 555 |
$marcrecordauth->insert_fields_ordered($authfield); |
561 |
$marcrecordauth->insert_fields_ordered($authfield); |
| 556 |
|
562 |
|
| 557 |
# bug 2317: ensure new authority knows it's using UTF-8; currently |
563 |
# bug 2317: ensure new authority knows it's using UTF-8; currently |