Bug 5453 Move declarations out of conditionals

Fix im members scripts

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Colin Campbell 2010-11-29 12:28:36 +00:00 committed by Chris Cormack
parent 129d97df97
commit 4a3ce35f2f
3 changed files with 29 additions and 19 deletions

View File

@ -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;

View File

@ -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');

View File

@ -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...