From 4a3ce35f2f07f49e9bb0826ad88e0c654630dfdb Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Mon, 29 Nov 2010 12:28:36 +0000 Subject: [PATCH] Bug 5453 Move declarations out of conditionals Fix im members scripts Signed-off-by: Chris Cormack --- members/mancredit.pl | 5 ++++- members/maninvoice.pl | 5 ++++- members/memberentry.pl | 38 +++++++++++++++++++++----------------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/members/mancredit.pl b/members/mancredit.pl index 7d57fa5a24..ae41b5776a 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -45,7 +45,10 @@ my $add=$input->param('add'); if ($add){ if(checkauth($input)) { my $barcode = $input->param('barcode'); - my $itemnum = GetItemnumberFromBarcode($barcode) if $barcode; + my $itemnum; + if ($barcode) { + $itemnum = GetItemnumberFromBarcode($barcode); + } my $desc = $input->param('desc'); my $note = $input->param('note'); my $amount = $input->param('amount') || 0; diff --git a/members/maninvoice.pl b/members/maninvoice.pl index f804e52666..9e8d4297b8 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -45,7 +45,10 @@ if ($add){ if(checkauth($input)) { # print $input->header; my $barcode=$input->param('barcode'); - my $itemnum = GetItemnumberFromBarcode($barcode) if $barcode; + my $itemnum; + if ($barcode) { + $itemnum = GetItemnumberFromBarcode($barcode); + } my $desc=$input->param('desc'); my $amount=$input->param('amount'); my $type=$input->param('type'); diff --git a/members/memberentry.pl b/members/memberentry.pl index be34cc41b0..f6ca2c1b6d 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -183,24 +183,28 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) } #############test for member being unique ############# -if (($op eq 'insert') and !$nodouble){ - my $category_type_send=$category_type if ($category_type eq 'I'); - my $check_category; # recover the category code of the doublon suspect borrowers - # ($result,$categorycode) = checkuniquemember($collectivity,$surname,$firstname,$dateofbirth) - ($check_member,$check_category) = checkuniquemember( - $category_type_send, - ($newdata{surname} ? $newdata{surname} : $data{surname} ), - ($newdata{firstname} ? $newdata{firstname} : $data{firstname} ), - ($newdata{dateofbirth} ? $newdata{dateofbirth} : $data{dateofbirth}) - ); - if(!$check_member){ - $nodouble = 1; - } - # recover the category type if the borrowers is a doublon +if ( ( $op eq 'insert' ) and !$nodouble ) { + my $category_type_send; + if ( $category_type eq 'I' ) { + $category_type_send = $category_type; + } + my $check_category; # recover the category code of the doublon suspect borrowers + # ($result,$categorycode) = checkuniquemember($collectivity,$surname,$firstname,$dateofbirth) + ( $check_member, $check_category ) = checkuniquemember( + $category_type_send, + ( $newdata{surname} ? $newdata{surname} : $data{surname} ), + ( $newdata{firstname} ? $newdata{firstname} : $data{firstname} ), + ( $newdata{dateofbirth} ? $newdata{dateofbirth} : $data{dateofbirth} ) + ); + if ( !$check_member ) { + $nodouble = 1; + } + + # recover the category type if the borrowers is a doublon if ($check_category) { - my $tmpborrowercategory=GetBorrowercategory($check_category); - $check_categorytype=$tmpborrowercategory->{'category_type'}; - } + my $tmpborrowercategory = GetBorrowercategory($check_category); + $check_categorytype = $tmpborrowercategory->{'category_type'}; + } } #recover all data from guarantor address phone ,fax... -- 2.39.5