[Koha-patches] [PATCH] bug 3821 -Suppress error on add item from subscriptions receive

Colin Campbell colin.campbell at ptfs-europe.com
Mon Dec 7 14:25:45 CET 2009


Serials receiving thinks undef is a valid value for indicators
Reset to space space if that received
---
 C4/Biblio.pm |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index cf48c91..31333b0 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -1675,15 +1675,11 @@ sub TransformHtmlToXml {
                 if (   ( @$tags[$i] && @$tags[$i] > 10 )
                     && ( @$values[$i] ne "" ) )
                 {
-                    my $ind1 = _default_ind_to_space(substr( @$indicator[$j], 0, 1 ));
-                    my $ind2;
-                    if ( @$indicator[$j] ) {
-                        $ind2 = _default_ind_to_space(substr( @$indicator[$j], 1, 1 ));
-                    }
-                    else {
-                        warn "Indicator in @$tags[$i] is empty";
-                        $ind2 = " ";
+                    if (!defined ${ $indicator}[$j] ) {
+                        ${$indicator}[$j] = q{  };
                     }
+                    my $ind1 = _default_ind_to_space(substr( ${$indicator}[$j], 0, 1 ));
+                    my $ind2 = _default_ind_to_space(substr( ${$indicator}[$j], 1, 1 ));
                     $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
                     $xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
                     $first = 0;
@@ -1707,8 +1703,11 @@ sub TransformHtmlToXml {
                         $first = 1;
                     }
                     else {
-                        my $ind1 = _default_ind_to_space( substr( @$indicator[$j], 0, 1 ) );
-                        my $ind2 = _default_ind_to_space( substr( @$indicator[$j], 1, 1 ) );
+                        if (!defined ${ $indicator}[$j] ) {
+                            ${$indicator}[$j] = q{  };
+                        }
+                        my $ind1 = _default_ind_to_space( substr( ${$indicator}[$j], 0, 1 ) );
+                        my $ind2 = _default_ind_to_space( substr( ${$indicator}[$j], 1, 1 ) );
                         $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
                         $xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
                         $first = 0;
@@ -1721,8 +1720,11 @@ sub TransformHtmlToXml {
             }
             else {
                 if ($first) {
-                    my $ind1 = _default_ind_to_space( substr( @$indicator[$j], 0, 1 ) );
-                    my $ind2 = _default_ind_to_space( substr( @$indicator[$j], 1, 1 ) );
+                    if (!defined ${ $indicator}[$j] ) {
+                        ${$indicator}[$j] = q{  };
+                    }
+                    my $ind1 = _default_ind_to_space( substr( ${$indicator}[$j], 0, 1 ) );
+                    my $ind2 = _default_ind_to_space( substr( ${$indicator}[$j], 1, 1 ) );
                     $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
                     $first = 0;
                 }
-- 
1.6.5.2




More information about the Koha-patches mailing list