Lines 36-42
BEGIN {
Link Here
|
36 |
GetMarcISBN |
36 |
GetMarcISBN |
37 |
GetMarcISSN |
37 |
GetMarcISSN |
38 |
GetMarcSubjects |
38 |
GetMarcSubjects |
39 |
GetMarcAuthors |
|
|
40 |
GetMarcSeries |
39 |
GetMarcSeries |
41 |
GetMarcUrls |
40 |
GetMarcUrls |
42 |
GetUsedMarcStructure |
41 |
GetUsedMarcStructure |
Lines 1694-1798
sub GetMarcSubjects {
Link Here
|
1694 |
return \@marcsubjects; |
1693 |
return \@marcsubjects; |
1695 |
} #end getMARCsubjects |
1694 |
} #end getMARCsubjects |
1696 |
|
1695 |
|
1697 |
=head2 GetMarcAuthors |
|
|
1698 |
|
1699 |
authors = GetMarcAuthors($record,$marcflavour); |
1700 |
|
1701 |
Get all authors from the MARC record and returns them in an array. |
1702 |
The authors are stored in different fields depending on MARC flavour |
1703 |
|
1704 |
=cut |
1705 |
|
1706 |
sub GetMarcAuthors { |
1707 |
my ( $record, $marcflavour ) = @_; |
1708 |
if (!$record) { |
1709 |
carp 'GetMarcAuthors called on undefined record'; |
1710 |
return; |
1711 |
} |
1712 |
my ( $mintag, $maxtag, $fields_filter ); |
1713 |
|
1714 |
# tagslib useful only for UNIMARC author responsibilities |
1715 |
my $tagslib; |
1716 |
if ( $marcflavour eq "UNIMARC" ) { |
1717 |
# FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct. |
1718 |
$tagslib = GetMarcStructure( 1, '', { unsafe => 1 }); |
1719 |
$mintag = "700"; |
1720 |
$maxtag = "712"; |
1721 |
$fields_filter = '7..'; |
1722 |
} else { # marc21/normarc |
1723 |
$mintag = "700"; |
1724 |
$maxtag = "720"; |
1725 |
$fields_filter = '7..'; |
1726 |
} |
1727 |
|
1728 |
my @marcauthors; |
1729 |
my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator'); |
1730 |
|
1731 |
foreach my $field ( $record->field($fields_filter) ) { |
1732 |
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag; |
1733 |
my @subfields_loop; |
1734 |
my @link_loop; |
1735 |
my @subfields = $field->subfields(); |
1736 |
my $count_auth = 0; |
1737 |
|
1738 |
# if there is an authority link, build the link with Koha-Auth-Number: subfield9 |
1739 |
my $subfield9 = $field->subfield('9'); |
1740 |
if ($subfield9) { |
1741 |
my $linkvalue = $subfield9; |
1742 |
$linkvalue =~ s/(\(|\))//g; |
1743 |
@link_loop = ( { 'limit' => 'an', 'link' => $linkvalue } ); |
1744 |
} |
1745 |
|
1746 |
# other subfields |
1747 |
my $unimarc3; |
1748 |
for my $authors_subfield (@subfields) { |
1749 |
next if ( $authors_subfield->[0] eq '9' ); |
1750 |
|
1751 |
# unimarc3 contains the $3 of the author for UNIMARC. |
1752 |
# For french academic libraries, it's the "ppn", and it's required for idref webservice |
1753 |
$unimarc3 = $authors_subfield->[1] if $marcflavour eq 'UNIMARC' and $authors_subfield->[0] =~ /3/; |
1754 |
|
1755 |
# don't load unimarc subfields 3, 5 |
1756 |
next if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /3|5/ ) ); |
1757 |
|
1758 |
my $code = $authors_subfield->[0]; |
1759 |
my $value = $authors_subfield->[1]; |
1760 |
my $linkvalue = $value; |
1761 |
$linkvalue =~ s/(\(|\))//g; |
1762 |
# UNIMARC author responsibility |
1763 |
if ( $marcflavour eq 'UNIMARC' and $code eq '4' ) { |
1764 |
$value = GetAuthorisedValueDesc( $field->tag(), $code, $value, '', $tagslib ); |
1765 |
$linkvalue = "($value)"; |
1766 |
} |
1767 |
# if no authority link, build a search query |
1768 |
unless ($subfield9) { |
1769 |
push @link_loop, { |
1770 |
limit => 'au', |
1771 |
'link' => $linkvalue, |
1772 |
operator => (scalar @link_loop) ? ' and ' : undef |
1773 |
}; |
1774 |
} |
1775 |
my @this_link_loop = @link_loop; |
1776 |
# do not display $0 |
1777 |
unless ( $code eq '0') { |
1778 |
push @subfields_loop, { |
1779 |
tag => $field->tag(), |
1780 |
code => $code, |
1781 |
value => $value, |
1782 |
link_loop => \@this_link_loop, |
1783 |
separator => (scalar @subfields_loop) ? $AuthoritySeparator : '' |
1784 |
}; |
1785 |
} |
1786 |
} |
1787 |
push @marcauthors, { |
1788 |
MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop, |
1789 |
authoritylink => $subfield9, |
1790 |
unimarc3 => $unimarc3 |
1791 |
}; |
1792 |
} |
1793 |
return \@marcauthors; |
1794 |
} |
1795 |
|
1796 |
=head2 GetMarcUrls |
1696 |
=head2 GetMarcUrls |
1797 |
|
1697 |
|
1798 |
$marcurls = GetMarcUrls($record,$marcflavour); |
1698 |
$marcurls = GetMarcUrls($record,$marcflavour); |