From 21e4d79be8b0a7204dd592528e20f5b8e29553ee Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Wed, 2 Nov 2011 16:24:05 +1300 Subject: [PATCH] Bug 6679 : Don't declare variables in conditionals Signed-off-by: Paul Poulain --- cataloguing/value_builder/macles.pl | 12 ++++++++---- cataloguing/value_builder/unimarc_field_4XX.pl | 15 +++++++++------ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/cataloguing/value_builder/macles.pl b/cataloguing/value_builder/macles.pl index 2d535c16e7..76f213b34a 100755 --- a/cataloguing/value_builder/macles.pl +++ b/cataloguing/value_builder/macles.pl @@ -118,20 +118,24 @@ my ($input) = @_; # use Data::Dumper;warn "BIGLOOP IN".Dumper(@BIGLOOP); } foreach my $num (sort keys %numbers){ - my @tmpcolhdr = @{$numbers{$num}->{'col_hdr'}} if ($numbers{$num}->{'col_hdr'}); - my @tmprowhdr = @{$numbers{$num}->{"row_hdr"}} if ($numbers{$num}->{'row_hdr'}); + my @tmpcolhdr; + my @tmprowhdr; + @tmpcolhdr = @{$numbers{$num}->{'col_hdr'}} if ($numbers{$num}->{'col_hdr'}); + @tmprowhdr = @{$numbers{$num}->{"row_hdr"}} if ($numbers{$num}->{'row_hdr'}); my @lines; my @lists; my %BIGLOOPcell; foreach my $row (@tmprowhdr){ my $tmprowvalue=$row->{rowvalue}; - my $rowcode=$1 if $tmprowvalue=~/[0-9]([0-9])\./; + my $rowcode; + $rowcode=$1 if $tmprowvalue=~/[0-9]([0-9])\./; my @cells; if (scalar(@tmpcolhdr)>0){ #cas du tableau bidim foreach my $col (@tmpcolhdr){ my $tmpcolvalue=$col->{colvalue}; - my $colcode=$1 if $tmpcolvalue=~/[0-9]\.([0-9])/; + my $colcode; + $colcode=$1 if $tmpcolvalue=~/[0-9]\.([0-9])/; my %cell; $cell{celvalue}=$num.$rowcode.$colcode; $cell{rowvalue}=$tmprowvalue; diff --git a/cataloguing/value_builder/unimarc_field_4XX.pl b/cataloguing/value_builder/unimarc_field_4XX.pl index ddb654712c..d3038ef395 100755 --- a/cataloguing/value_builder/unimarc_field_4XX.pl +++ b/cataloguing/value_builder/unimarc_field_4XX.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Copyright 2000-2002 Katipo Communications +# Copyright Biblibre 2007 # # This file is part of Koha. # @@ -204,12 +204,14 @@ sub plugin { elsif ( $marcrecord->field('200') ) { $subfield_value_a = $marcrecord->subfield( '200', 'f' ); } - my $subfield_value_c = $marcrecord->field('210')->subfield("a") + my $subfield_value_c; + my $subfield_value_d; + my $subfield_value_e; + $subfield_value_c = $marcrecord->field('210')->subfield("a") if ( $marcrecord->field('210') ); - my $subfield_value_d = $marcrecord->field('210')->subfield("d") + $subfield_value_d = $marcrecord->field('210')->subfield("d") if ( $marcrecord->field('210') ); - - my $subfield_value_e = $marcrecord->field('205')->subfield("a") + $subfield_value_e = $marcrecord->field('205')->subfield("a") if ( $marcrecord->field('205') ); my $subfield_value_h; @@ -246,7 +248,8 @@ sub plugin { $subfield_value_i = $marcrecord->field('500')->subfield("i"); } - my $subfield_value_p = $marcrecord->field('215')->subfield("a") + my $subfield_value_p; + $subfield_value_p = $marcrecord->field('215')->subfield("a") if ( $marcrecord->field('215') ); my $subfield_value_t; -- 2.39.5