[Koha-patches] [PATCH] bug 3614 followup

Galen Charlton gmcharlt at gmail.com
Tue Sep 15 15:21:24 CEST 2009


* renamed default_ind_to_space to _default_ind_to_space
  as it is an internal function
* added calls to _default_ind_to_space in other places

Signed-off-by: Galen Charlton <gmcharlt at gmail.com>
---
 C4/Biblio.pm |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index b851bc0..cf48c91 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -1675,10 +1675,10 @@ sub TransformHtmlToXml {
                 if (   ( @$tags[$i] && @$tags[$i] > 10 )
                     && ( @$values[$i] ne "" ) )
                 {
-                    my $ind1 = substr( @$indicator[$j], 0, 1 );
+                    my $ind1 = _default_ind_to_space(substr( @$indicator[$j], 0, 1 ));
                     my $ind2;
                     if ( @$indicator[$j] ) {
-                        $ind2 = substr( @$indicator[$j], 1, 1 );
+                        $ind2 = _default_ind_to_space(substr( @$indicator[$j], 1, 1 ));
                     }
                     else {
                         warn "Indicator in @$tags[$i] is empty";
@@ -1707,8 +1707,8 @@ 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 ) );
+                        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 +1721,8 @@ 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 ) );
+                    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;
                 }
@@ -1749,16 +1749,16 @@ sub TransformHtmlToXml {
     return $xml;
 }
 
-=head2 default_ind_to_space
+=head2 _default_ind_to_space
 
 Passed what should be an indicator returns a space
 if its undefined or zero length
 
 =cut
 
-sub default_ind_to_space {
+sub _default_ind_to_space {
     my $s = shift;
-    if (!defined $s || $s eq q{} ) {
+    if (!defined $s || $s eq q{}) {
         return ' ';
     }
     return $s;
@@ -1836,8 +1836,8 @@ sub TransformHtmlToMarc {
         elsif ($param =~ /^tag_(\d*)_indicator1_/){ # new field start when having 'input name="..._indicator1_..."
             my $tag  = $1;
             
-            my $ind1 = substr($cgi->param($param),0,1);
-            my $ind2 = substr($cgi->param($params->[$i+1]),0,1);
+            my $ind1 = _default_ind_to_space(substr($cgi->param($param),          0, 1));
+            my $ind2 = _default_ind_to_space(substr($cgi->param($params->[$i+1]), 0, 1));
             $newfield=0;
             my $j=$i+2;
             
@@ -1866,8 +1866,8 @@ sub TransformHtmlToMarc {
                         if ( $cgi->param($params->[$j+1]) ne '' ) { # creating only if there is a value (code => value)
                             $newfield = MARC::Field->new(
                                 $tag,
-                                ''.$ind1,
-                                ''.$ind2,
+                                $ind1,
+                                $ind2,
                                 $cgi->param($inner_param) => $cgi->param($params->[$j+1]),
                             );
                         }
-- 
1.6.3.3




More information about the Koha-patches mailing list