From 92af2c2dc70ce20dcebba2c2812af6f46675fda2 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 10 Feb 2020 15:17:38 +0000 Subject: [PATCH] Bug 13574: Fix display of repeatable item subfields Applies to OPAC and staff: opac-MARCdetail and catalogue/MARCdetail. Test plan: [1] Pick an item. Pick two fields say URI and copy number, and fill these with a value like A | B. (The pipe char is important.) [2] Verify that the display of the item block on opac-MARCdetail shows both A and B in those columns. (Previously only B was shown.) [3] Verify the same on catalogue MARC detail, items tab. Signed-off-by: Marcel de Rooy Signed-off-by: Holly Cooper Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson (cherry picked from commit 3b3a84d272fd6ee1259273e132739a4caa8bc616) Signed-off-by: Lucas Gass --- catalogue/MARCdetail.pl | 20 +++++++++++++++----- opac/opac-MARCdetail.pl | 13 ++++++++++--- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 2a93c2bb6c..3854a34d05 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -268,14 +268,24 @@ foreach my $field (@fields) { for my $i ( 0 .. $#subf ) { next if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{tab} ne 10 ); next if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{hidden} =~ /-7|-4|-3|-2|2|3|5|8/); + push @item_subfield_codes, $subf[$i][0]; $witness{ $subf[$i][0] } = $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{lib}; - $item->{ $subf[$i][0] } = GetAuthorisedValueDesc( $field->tag(), - $subf[$i][0], $subf[$i][1], '', $tagslib) || $subf[$i][1]; - $norequests = 0 - if $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.notforloan' - and $subf[$i][1] == 0; + + # Allow repeatables (BZ 13574) + if( $item->{$subf[$i][0]}) { + $item->{$subf[$i][0]} .= ' | '; + } else { + $item->{$subf[$i][0]} = q{}; + } + if( $tagslib->{$field->tag()}->{$subf[$i][0]}->{isurl} ) { + $item->{$subf[$i][0]} .= "$subf[$i][1]"; + } else { + $item->{ $subf[$i][0] } .= GetAuthorisedValueDesc( $field->tag(), $subf[$i][0], $subf[$i][1], '', $tagslib) || $subf[$i][1]; + } + + $norequests = 0 if $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.notforloan' and $subf[$i][1] == 0; } push @item_loop, $item if $item; } diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index dd709003a8..c9f85bbb64 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -293,14 +293,21 @@ foreach my $field (@fields) { push @item_subfield_codes, $subf[$i][0]; $witness{ $subf[$i][0] } = $sf_def->{lib}; + # Allow repeatables (BZ 13574) + if( $item->{$subf[$i][0]} ) { + $item->{$subf[$i][0]} .= ' | '; + } else { + $item->{$subf[$i][0]} = q{}; + } + if ( $sf_def->{isurl} ) { - $item->{ $subf[$i][0] } = "$subf[$i][1]"; + $item->{ $subf[$i][0] } .= "$subf[$i][1]"; } elsif ( $sf_def->{kohafield} eq "biblioitems.isbn" ) { - $item->{ $subf[$i][0] } = $subf[$i][1]; + $item->{ $subf[$i][0] } .= $subf[$i][1]; } else { - $item->{ $subf[$i][0] } = GetAuthorisedValueDesc( $field->tag(), $subf[$i][0], + $item->{ $subf[$i][0] } .= GetAuthorisedValueDesc( $field->tag(), $subf[$i][0], $subf[$i][1], '', $tagslib, '', 'opac' ); } } -- 2.39.5