[Koha-patches] [PATCH] Explicitly set _find_value's return to a string if not defined

Colin Campbell colin.campbell at ptfs-europe.com
Tue Jul 21 12:59:09 CEST 2009


 Avoids generating a slew of warnings in the log when the undefined
 value was concatenated or used in regexps
---
 C4/Biblio.pm |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 803a921..d20d747 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -2184,10 +2184,14 @@ sub PrepareItemrecordDisplay {
                   $tagslib->{$tag}->{$subfield}->{repeatable};
                 $subfield_data{hidden} = "display:none"
                   if $tagslib->{$tag}->{$subfield}->{hidden};
-                my ( $x, $value );
-                ( $x, $value ) = _find_value( $tag, $subfield, $itemrecord )
-                  if ($itemrecord);
-                $value =~ s/"/"/g;
+                  my ( $x, $value );
+                  if ($itemrecord) {
+                      ( $x, $value ) = _find_value( $tag, $subfield, $itemrecord );
+                  }
+                  if (!defined $value) {
+                      $value = q||;
+                  }
+                  $value =~ s/"/"/g;
 
                 # search for itemcallnumber if applicable
                 if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq
-- 
1.6.2.5




More information about the Koha-patches mailing list