bug 3614 followup

* 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@gmail.com>
This commit is contained in:
Galen Charlton 2009-09-15 09:19:57 -04:00
parent dab68f884f
commit 4e5fe41a59
1 changed files with 13 additions and 13 deletions

View File

@ -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]),
);
}