Bug 5453 Move declarations out of conditionals
authorColin Campbell <colin.campbell@ptfs-europe.com>
Mon, 29 Nov 2010 12:28:36 +0000 (12:28 +0000)
committerChris Cormack <chrisc@catalyst.net.nz>
Fri, 15 Jul 2011 03:50:22 +0000 (15:50 +1200)
Fix im members scripts

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
members/mancredit.pl
members/maninvoice.pl
members/memberentry.pl

index 7d57fa5..ae41b57 100755 (executable)
@@ -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;
index f804e52..9e8d429 100755 (executable)
@@ -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');
index be34cc4..f6ca2c1 100755 (executable)
@@ -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...