From c71c4bf9c5fddcb332e5c79e95ed67ff9bd95a24 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Mon, 26 Oct 2009 17:31:27 +0100 Subject: [PATCH] Followup bfffa5 TransformHTMLToXML bug fix _default_ind_to_space had problems --- C4/Biblio.pm | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 5e5825e6a7..d754be7fad 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1744,7 +1744,6 @@ sub TransformHtmlToXml { my $prevtag = -1; my $first = 1; my $j = -1; - @$indicator=map{sprintf("%2s",$_) unless ( length($_)<2)}@$indicator; for ( my $i = 0 ; $i < @$tags ; $i++ ) { if (C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a") { # if we have a 100 field and it's values are not correct, skip them. @@ -1766,20 +1765,22 @@ sub TransformHtmlToXml { # } if ( ( @$tags[$i] ne $prevtag ) ) { $j++ unless ( @$tags[$i] eq "" ); + my $indicator1=eval{substr( @$indicator[$j], 0, 1 )}; + my $indicator2=eval{substr( @$indicator[$j], 1, 1 )}; + my $ind1 = _default_ind_to_space($indicator1); + my $ind2; + if ( @$indicator[$j] ) { + $ind2 = _default_ind_to_space($indicator2); + } + else { + warn "Indicator in @$tags[$i] is empty"; + $ind2 = " "; + } if ( !$first ) { $xml .= "\n"; 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 = " "; - } $xml .= "\n"; $xml .= "@$values[$i]\n"; $first = 0; @@ -1803,8 +1804,6 @@ 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 ) ); $xml .= "\n"; $xml .= "@$values[$i]\n"; $first = 0; @@ -1817,8 +1816,6 @@ 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 ) ); $xml .= "\n"; $first = 0; } -- 2.39.5