Lines 1746-1755
sub GetMarcISSN {
Link Here
|
1746 |
|
1746 |
|
1747 |
=head2 GetMarcNotes |
1747 |
=head2 GetMarcNotes |
1748 |
|
1748 |
|
1749 |
$marcnotesarray = GetMarcNotes( $record, $marcflavour ); |
1749 |
$marcnotesarray = GetMarcNotes( $record, $marcflavour ); |
1750 |
|
1750 |
|
1751 |
Get all notes from the MARC record and returns them in an array. |
1751 |
Get all notes from the MARC record and returns them in an array. |
1752 |
The note are stored in different fields depending on MARC flavour |
1752 |
The notes are stored in different fields depending on MARC flavour. |
|
|
1753 |
MARC21 field 555 gets special attention for the $u subfields. |
1753 |
|
1754 |
|
1754 |
=cut |
1755 |
=cut |
1755 |
|
1756 |
|
Lines 1759-1792
sub GetMarcNotes {
Link Here
|
1759 |
carp 'GetMarcNotes called on undefined record'; |
1760 |
carp 'GetMarcNotes called on undefined record'; |
1760 |
return; |
1761 |
return; |
1761 |
} |
1762 |
} |
1762 |
my $scope; |
1763 |
|
1763 |
if ( $marcflavour eq "UNIMARC" ) { |
1764 |
my $scope = $marcflavour eq "UNIMARC"? '3..': '5..'; |
1764 |
$scope = '3..'; |
|
|
1765 |
} else { # assume marc21 if not unimarc |
1766 |
$scope = '5..'; |
1767 |
} |
1768 |
my @marcnotes; |
1765 |
my @marcnotes; |
1769 |
my $note = ""; |
1766 |
my %blacklist = map { $_ => 1 } |
1770 |
my $tag = ""; |
1767 |
split( /,/, C4::Context->preference('NotesBlacklist')); |
1771 |
my $marcnote; |
|
|
1772 |
my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist')); |
1773 |
foreach my $field ( $record->field($scope) ) { |
1768 |
foreach my $field ( $record->field($scope) ) { |
1774 |
my $tag = $field->tag(); |
1769 |
my $tag = $field->tag(); |
1775 |
next if $blacklist{$tag}; |
1770 |
next if $blacklist{ $tag }; |
1776 |
|
|
|
1777 |
my $value = $field->as_string(); |
1778 |
if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) { |
1771 |
if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) { |
1779 |
my @sub= $field->subfield('u'); |
1772 |
# Field 555$u contains URLs |
1780 |
foreach my $s (@sub) { |
1773 |
# We first push the regular subfields and all $u's separately |
1781 |
next if $s !~ /^http/; |
1774 |
# Leave further actions to the template |
1782 |
my $i= index( $value, $s); |
1775 |
push @marcnotes, { marcnote => $field->as_string('abcd') }; |
1783 |
$value= substr( $value,0, $i) . "<a href=\"$s\" target=\"_blank\">$s</a>" . substr( $value, $i + length($s) ); |
1776 |
foreach my $sub ( $field->subfield('u') ) { |
|
|
1777 |
push @marcnotes, { marcnote => $sub }; |
1784 |
} |
1778 |
} |
|
|
1779 |
} else { |
1780 |
push @marcnotes, { marcnote => $field->as_string() }; |
1785 |
} |
1781 |
} |
1786 |
push @marcnotes, { marcnote => $value }; |
|
|
1787 |
} |
1782 |
} |
1788 |
return \@marcnotes; |
1783 |
return \@marcnotes; |
1789 |
} # end GetMarcNotes |
1784 |
} |
1790 |
|
1785 |
|
1791 |
=head2 GetMarcSubjects |
1786 |
=head2 GetMarcSubjects |
1792 |
|
1787 |
|