Lines 33-39
BEGIN {
Link Here
|
33 |
GetMarcControlnumber |
33 |
GetMarcControlnumber |
34 |
GetMarcISBN |
34 |
GetMarcISBN |
35 |
GetMarcISSN |
35 |
GetMarcISSN |
36 |
GetMarcSubjects |
|
|
37 |
GetMarcSeries |
36 |
GetMarcSeries |
38 |
GetMarcUrls |
37 |
GetMarcUrls |
39 |
GetUsedMarcStructure |
38 |
GetUsedMarcStructure |
Lines 1499-1593
sub GetMarcISSN {
Link Here
|
1499 |
return \@marcissns; |
1498 |
return \@marcissns; |
1500 |
} # end GetMarcISSN |
1499 |
} # end GetMarcISSN |
1501 |
|
1500 |
|
1502 |
=head2 GetMarcSubjects |
|
|
1503 |
|
1504 |
$marcsubjcts = GetMarcSubjects($record,$marcflavour); |
1505 |
|
1506 |
Get all subjects from the MARC record and returns them in an array. |
1507 |
The subjects are stored in different fields depending on MARC flavour |
1508 |
|
1509 |
=cut |
1510 |
|
1511 |
sub GetMarcSubjects { |
1512 |
my ( $record, $marcflavour ) = @_; |
1513 |
if (!$record) { |
1514 |
carp 'GetMarcSubjects called on undefined record'; |
1515 |
return; |
1516 |
} |
1517 |
my ( $mintag, $maxtag, $fields_filter ); |
1518 |
if ( $marcflavour eq "UNIMARC" ) { |
1519 |
$mintag = "600"; |
1520 |
$maxtag = "611"; |
1521 |
$fields_filter = '6..'; |
1522 |
} else { # marc21 |
1523 |
$mintag = "600"; |
1524 |
$maxtag = "699"; |
1525 |
$fields_filter = '6..'; |
1526 |
} |
1527 |
|
1528 |
my @marcsubjects; |
1529 |
|
1530 |
my $subject_limit = C4::Context->preference("TraceCompleteSubfields") ? 'su,complete-subfield' : 'su'; |
1531 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
1532 |
|
1533 |
foreach my $field ( $record->field($fields_filter) ) { |
1534 |
next unless ($field->tag() >= $mintag && $field->tag() <= $maxtag); |
1535 |
my @subfields_loop; |
1536 |
my @subfields = $field->subfields(); |
1537 |
my @link_loop; |
1538 |
|
1539 |
# if there is an authority link, build the links with an= subfield9 |
1540 |
my $subfield9 = $field->subfield('9'); |
1541 |
my $authoritylink; |
1542 |
if ($subfield9) { |
1543 |
my $linkvalue = $subfield9; |
1544 |
$linkvalue =~ s/(\(|\))//g; |
1545 |
@link_loop = ( { limit => 'an', 'link' => $linkvalue } ); |
1546 |
$authoritylink = $linkvalue |
1547 |
} |
1548 |
|
1549 |
# other subfields |
1550 |
for my $subject_subfield (@subfields) { |
1551 |
next if ( $subject_subfield->[0] eq '9' ); |
1552 |
|
1553 |
# don't load unimarc subfields 3,4,5 |
1554 |
next if ( ( $marcflavour eq "UNIMARC" ) and ( $subject_subfield->[0] =~ /2|3|4|5/ ) ); |
1555 |
# don't load MARC21 subfields 2 (FIXME: any more subfields??) |
1556 |
next if ( ( $marcflavour eq "MARC21" ) and ( $subject_subfield->[0] =~ /2/ ) ); |
1557 |
|
1558 |
my $code = $subject_subfield->[0]; |
1559 |
my $value = $subject_subfield->[1]; |
1560 |
my $linkvalue = $value; |
1561 |
$linkvalue =~ s/(\(|\))//g; |
1562 |
# if no authority link, build a search query |
1563 |
unless ($subfield9) { |
1564 |
push @link_loop, { |
1565 |
limit => $subject_limit, |
1566 |
'link' => $linkvalue, |
1567 |
operator => (scalar @link_loop) ? ' AND ' : undef |
1568 |
}; |
1569 |
} |
1570 |
my @this_link_loop = @link_loop; |
1571 |
# do not display $0 |
1572 |
unless ( $code eq '0' ) { |
1573 |
push @subfields_loop, { |
1574 |
code => $code, |
1575 |
value => $value, |
1576 |
link_loop => \@this_link_loop, |
1577 |
separator => (scalar @subfields_loop) ? $AuthoritySeparator : '' |
1578 |
}; |
1579 |
} |
1580 |
} |
1581 |
|
1582 |
push @marcsubjects, { |
1583 |
MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop, |
1584 |
authoritylink => $authoritylink, |
1585 |
} if $authoritylink || @subfields_loop; |
1586 |
|
1587 |
} |
1588 |
return \@marcsubjects; |
1589 |
} #end getMARCsubjects |
1590 |
|
1591 |
=head2 GetMarcUrls |
1501 |
=head2 GetMarcUrls |
1592 |
|
1502 |
|
1593 |
$marcurls = GetMarcUrls($record,$marcflavour); |
1503 |
$marcurls = GetMarcUrls($record,$marcflavour); |