Bug 18198: MARC21: Further improve handling of 5XX$u in GetMarcNotes

Bug 14306 only handled field 555 in MARC21 as an URI. But a lot of other
5XX fields have a $u subfield for URIs; actually $u is not used in any
other way. This patch generalizes the change made for 555 and extends
it to all 5XX $u.

Test plan:
[1] Run t/Biblio.t
[2] Run t/db_dependent/Biblio.t
[3] Edit a MARC21 record. Add a URL into 505u, 520u, 555u.
[4] Check presentation on opac-detail (tab Title notes)
[5] Check presentation on catalogue/detail (tab Descriptions)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2017-03-02 12:59:37 +01:00 committed by Jonathan Druart
parent 320e66b043
commit 9215cb7caf

View file

@ -1710,7 +1710,7 @@ sub GetMarcISSN {
Get all notes from the MARC record and returns them in an array.
The notes are stored in different fields depending on MARC flavour.
MARC21 field 555 gets special attention for the $u subfields.
MARC21 5XX $u subfields receive special attention as they are URIs.
=cut
@ -1728,12 +1728,16 @@ sub GetMarcNotes {
foreach my $field ( $record->field($scope) ) {
my $tag = $field->tag();
next if $blacklist{ $tag };
if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) {
# Field 555$u contains URLs
# We first push the regular subfields and all $u's separately
# Leave further actions to the template
push @marcnotes, { marcnote => $field->as_string('abcd') };
if( $marcflavour ne 'UNIMARC' && $field->subfield('u') ) {
# Field 5XX$u always contains URI
# Examples: 505u, 506u, 510u, 514u, 520u, 530u, 538u, 540u, 542u, 552u, 555u, 561u, 563u, 583u
# We first push the other subfields, then all $u's separately
# Leave further actions to the template (see e.g. opac-detail)
my $othersub =
join '', ( 'a' .. 't', 'v' .. 'z', '0' .. '9' ); # excl 'u'
push @marcnotes, { marcnote => $field->as_string($othersub) };
foreach my $sub ( $field->subfield('u') ) {
$sub =~ s/^\s+|\s+$//g; # trim
push @marcnotes, { marcnote => $sub };
}
} else {