Lines 1768-1777
sub GetMarcISSN {
Link Here
|
1768 |
|
1768 |
|
1769 |
=head2 GetMarcNotes |
1769 |
=head2 GetMarcNotes |
1770 |
|
1770 |
|
1771 |
$marcnotesarray = GetMarcNotes( $record, $marcflavour ); |
1771 |
$marcnotesarray = GetMarcNotes( $record, $marcflavour ); |
1772 |
|
1772 |
|
1773 |
Get all notes from the MARC record and returns them in an array. |
1773 |
Get all notes from the MARC record and returns them in an array. |
1774 |
The note are stored in different fields depending on MARC flavour |
1774 |
The notes are stored in different fields depending on MARC flavour. |
|
|
1775 |
MARC21 field 555 gets special attention for the $u subfields. |
1775 |
|
1776 |
|
1776 |
=cut |
1777 |
=cut |
1777 |
|
1778 |
|
Lines 1781-1814
sub GetMarcNotes {
Link Here
|
1781 |
carp 'GetMarcNotes called on undefined record'; |
1782 |
carp 'GetMarcNotes called on undefined record'; |
1782 |
return; |
1783 |
return; |
1783 |
} |
1784 |
} |
1784 |
my $scope; |
1785 |
|
1785 |
if ( $marcflavour eq "UNIMARC" ) { |
1786 |
my $scope = $marcflavour eq "UNIMARC"? '3..': '5..'; |
1786 |
$scope = '3..'; |
|
|
1787 |
} else { # assume marc21 if not unimarc |
1788 |
$scope = '5..'; |
1789 |
} |
1790 |
my @marcnotes; |
1787 |
my @marcnotes; |
1791 |
my $note = ""; |
1788 |
my %blacklist = map { $_ => 1 } |
1792 |
my $tag = ""; |
1789 |
split( /,/, C4::Context->preference('NotesBlacklist')); |
1793 |
my $marcnote; |
|
|
1794 |
my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist')); |
1795 |
foreach my $field ( $record->field($scope) ) { |
1790 |
foreach my $field ( $record->field($scope) ) { |
1796 |
my $tag = $field->tag(); |
1791 |
my $tag = $field->tag(); |
1797 |
next if $blacklist{$tag}; |
1792 |
next if $blacklist{ $tag }; |
1798 |
|
|
|
1799 |
my $value = $field->as_string(); |
1800 |
if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) { |
1793 |
if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) { |
1801 |
my @sub= $field->subfield('u'); |
1794 |
# Field 555$u contains URLs |
1802 |
foreach my $s (@sub) { |
1795 |
# We first push the regular subfields and all $u's separately |
1803 |
next if $s !~ /^http/; |
1796 |
# Leave further actions to the template |
1804 |
my $i= index( $value, $s); |
1797 |
push @marcnotes, { marcnote => $field->as_string('abcd') }; |
1805 |
$value= substr( $value,0, $i) . "<a href=\"$s\" target=\"_blank\">$s</a>" . substr( $value, $i + length($s) ); |
1798 |
foreach my $sub ( $field->subfield('u') ) { |
|
|
1799 |
push @marcnotes, { marcnote => $sub }; |
1806 |
} |
1800 |
} |
|
|
1801 |
} else { |
1802 |
push @marcnotes, { marcnote => $field->as_string() }; |
1807 |
} |
1803 |
} |
1808 |
push @marcnotes, { marcnote => $value }; |
|
|
1809 |
} |
1804 |
} |
1810 |
return \@marcnotes; |
1805 |
return \@marcnotes; |
1811 |
} # end GetMarcNotes |
1806 |
} |
1812 |
|
1807 |
|
1813 |
=head2 GetMarcSubjects |
1808 |
=head2 GetMarcSubjects |
1814 |
|
1809 |
|