From 4169d90ce49062f82a1b3202c13627d8eaf33b68 Mon Sep 17 00:00:00 2001 From: Srdjan Date: Tue, 12 Nov 2013 20:53:39 +1300 Subject: [PATCH] bug_11183: Supress undef warning in opac-MARCdetail.pl To test: * Go to /cgi-bin/koha/opac-MARCdetail.pl?biblionumber= and confirm that pre and post patch page looks the same. An apology: I tried to find a syspref combination that displays opac-MARCdetail.pl links in OPAC search results, and failed. If anyone knows, the secret combination, please disclose. I resorted to entering the url by hand. --- opac/opac-MARCdetail.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index d6be0a6..bb19998 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -176,8 +176,9 @@ for ( my $tabloop = 0 ; $tabloop <= 9 ; $tabloop++ ) { next if ( ($sf_def->{tab}||0) != $tabloop ); next if ( ($sf_def->{hidden}||0) > 0 ); my %subfield_data; - $subfield_data{marc_lib} = ($sf_def->{lib} eq $previous) ? '--' : $sf_def->{lib}; - $previous = $sf_def->{lib}; + my $lib = $sf_def->{lib} // ''; + $subfield_data{marc_lib} = ($lib eq $previous) ? '--' : $sf_def->{lib}; + $previous = $lib; $subfield_data{link} = $sf_def->{link}; $subf[$i][1] =~ s/\n//g; if ( $sf_def->{isurl} ) { @@ -211,12 +212,13 @@ for ( my $tabloop = 0 ; $tabloop <= 9 ; $tabloop++ ) { $tag_data{tag} = $tagslib->{ $fields[$x_i]->tag() }->{lib}; } else { + my $tag = $fields[$x_i]->tag(); $tag_data{tag} = - $fields[$x_i]->tag() + $tag . ' ' . C4::Koha::display_marc_indicators($fields[$x_i]) . ' - ' - . $tagslib->{ $fields[$x_i]->tag() }->{lib}; + . ($tagslib->{ $tag }->{lib} // ''); } } my @tmp = @subfields_data; -- 1.8.1.2