[Koha-patches] [PATCH] bug_11183: Supress undef warning in opac-MARCdetail.pl

Srdjan srdjan at catalyst.net.nz
Tue Nov 12 09:07:27 CET 2013


To test:
* Go to /cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<your fav 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/<br\/>/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


More information about the Koha-patches mailing list