Bug 13574: Fix display of repeatable item subfields
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 10 Feb 2020 15:17:38 +0000 (15:17 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 17 Feb 2020 10:38:06 +0000 (10:38 +0000)
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 <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Holly Cooper <hc@interleaf.ie>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

catalogue/MARCdetail.pl
opac/opac-MARCdetail.pl

index adfe24c..7c25038 100755 (executable)
@@ -276,14 +276,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]} .= "<a href=\"$subf[$i][1]\">$subf[$i][1]</a>";
+        } 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;
 }
index 4bc9294..545af32 100755 (executable)
@@ -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] } = "<a href=\"$subf[$i][1]\">$subf[$i][1]</a>";
+            $item->{ $subf[$i][0] } .= "<a href=\"$subf[$i][1]\">$subf[$i][1]</a>";
         }
         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' );
         }
     }