From 02415cb0a2401a900f3ef9fb3e3c99316d2f3b23 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 | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 713e4fac89..f3ced58ed4 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1769,7 +1769,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. @@ -1791,20 +1790,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; @@ -1828,8 +1829,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; @@ -1838,12 +1837,21 @@ sub TransformHtmlToXml { } } else { # @$tags[$i] eq $prevtag + 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 ( @$values[$i] eq "" ) { } 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