Followup bfffa5 TransformHTMLToXML bug fix
_default_ind_to_space had problems
This commit is contained in:
parent
d31ac1f375
commit
c71c4bf9c5
25
C4/Biblio.pm
25
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 .= "</datafield>\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 .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
|
||||
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\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 .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
|
||||
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\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 .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
|
||||
$first = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue