Deleted unused variables.
[srvgit] / C4 / Circulation / Borrower.pm
index 18fac93..968d9c3 100755 (executable)
@@ -1,4 +1,6 @@
-package C4::Circulation::Borrower; #assumes C4/Circulation/Borrower
+package C4::Circulation::Borrower;
+
+# $Id$
 
 #package to deal with Issues
 #written 3/11/99 by chris@katipo.co.nz
@@ -41,49 +43,14 @@ use C4::Scan;
 use C4::Search;
 use C4::Stats;
 use C4::Format;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-  
+use vars qw($VERSION @ISA @EXPORT);
+
 # set the version for version checking
 $VERSION = 0.01;
-    
+
 @ISA = qw(Exporter);
 @EXPORT = qw(&findborrower &Borenq &findoneborrower &NewBorrowerNumber
 &findguarantees);
-%EXPORT_TAGS = ( );     # eg: TAG => [ qw!name1 name2! ],
-                 
-# your exported package globals go here,
-# as well as any optionally exported functions
-
-@EXPORT_OK   = qw($Var1 %Hashit);
-
-
-# non-exported package globals go here
-use vars qw(@more $stuff);
-       
-# initalize package globals, first exported ones
-
-my $Var1   = '';
-my %Hashit = ();
-                   
-# then the others (which are still accessible as $Some::Module::stuff)
-my $stuff  = '';
-my @more   = ();
-       
-# all file-scoped lexicals must be created before
-# the functions below that use them.
-               
-# file-private lexicals go here
-my $priv_var    = '';
-my %secret_hash = ();
-                           
-# here's a file-private function as a closure,
-# callable as &$priv_func;  it cannot be prototyped.
-my $priv_func = sub {
-  # stuff goes here.
-};
-                                                   
-# make all your functions, whether exported or not;
-
 
 sub findborrower  {
   my ($env,$dbh) = @_;
@@ -99,38 +66,38 @@ sub findborrower  {
     #get borrowerbarcode from scanner
     my $title = C4::InterfaceCDK::titlepanel($env,$env->{'sysarea'},"Borrower Entry");
     if ($env->{'newborrower'} eq "") {
-      ($borcode,$reason,$book)=&C4::Circulation::Main::scanborrower($env); 
-    } else { 
+      ($borcode,$reason,$book)=&C4::Circulation::Main::scanborrower($env);
+    } else {
       $borcode = $env->{'newborrower'};
       $reason = "";
       $book = "";
       $env->{'newborrower'}= "";
-    }  
+    }
     #C4::Circulation::Main
     if ($reason eq "") {
       if ($borcode ne '') {
         ($bornum,$borrower) = findoneborrower($env,$dbh,$borcode);
         $env->{'IssuesAllowed'} = 1;
       } elsif ($book ne "") {
-        my $query = "select * from issues,items where (barcode = '$book') 
-          and (items.itemnumber = issues.itemnumber) 
+        my $query = "select * from issues,items where (barcode = '$book')
+          and (items.itemnumber = issues.itemnumber)
           and (issues.returndate is null)";
         my $iss_sth=$dbh->prepare($query);
         $iss_sth->execute;
         if (my $issdata  = $iss_sth->fetchrow_hashref) {
            $bornum=$issdata->{'borrowernumber'};
-          $sth = $dbh->prepare("Select * from borrowers 
+          $sth = $dbh->prepare("Select * from borrowers
             where borrowernumber =  '$bornum'");
           $sth->execute;
           $borrower=$sth->fetchrow_hashref;
-          $sth->finish;  
+          $sth->finish;
          } else {
            error_msg($env,"Item $book not found");
-         } 
+         }
         $iss_sth->finish;
       }
-    } 
-  } 
+    }
+  }
   my ($issuesallowed,$owing);
   if ($reason eq "") {
     $env->{'bornum'} = $bornum;
@@ -161,8 +128,8 @@ sub findoneborrower {
     $sth->finish;
     # my $borquery = "Select * from borrowers
     # where surname ~* '$borcode' order by surname";
-             
-    my $borquery = "Select * from borrowers 
+
+    my $borquery = "Select * from borrowers
       where lower(surname) like \"$lcborcode%\" order by surname,firstname";
     my $sthb =$dbh->prepare($borquery);
     $sthb->execute;
@@ -177,17 +144,17 @@ sub findoneborrower {
       $cntbor++;
     }
     if ($cntbor == 1)  {
-      $bornum = $bornums[0];       
-      my $query = "select * from borrowers where borrowernumber = '$bornum'";     
+      $bornum = $bornums[0];
+      my $query = "select * from borrowers where borrowernumber = '$bornum'";
       $sth = $dbh->prepare($query);
       $sth->execute;
       $borrower =$sth->fetchrow_hashref;
-      $sth->finish;                                             
+      $sth->finish;
     } elsif ($cntbor > 0) {
       my ($cardnum) = C4::InterfaceCDK::selborrower($env,$dbh,\@borrows,\@bornums);
-      my $query = "select * from borrowers where cardnumber = '$cardnum'";   
-      $sth = $dbh->prepare($query);                          
-      $sth->execute;                          
+      my $query = "select * from borrowers where cardnumber = '$cardnum'";
+      $sth = $dbh->prepare($query);
+      $sth->execute;
       $borrower =$sth->fetchrow_hashref;
       $sth->finish;
       $bornum=$borrower->{'borrowernumber'};
@@ -195,22 +162,22 @@ sub findoneborrower {
       if ($bornum eq '') {
         error_msg($env,"Borrower not found");
       }
-    }  
+    }
   }
-  return ($bornum,$borrower); 
+  return ($bornum,$borrower);
 }
 sub checktraps {
   my ($env,$dbh,$bornum,$borrower) = @_;
   my $issuesallowed = "1";
   #my @traps_set;
   #check amountowing
-  my $traps_done; 
+  my $traps_done;
   my $odues;
   my $amount;
   while ($traps_done ne "DONE") {
     my @traps_set;
     $amount=C4::Accounts::checkaccount($env,$bornum,$dbh);    #from C4::Accounts
-    if ($amount > 0) { push (@traps_set,"CHARGES");}  
+    if ($amount > 0) { push (@traps_set,"CHARGES");}
     if ($borrower->{'gonenoaddress'} == 1){ push (@traps_set,"GNA");}
     #check if member has a card reported as lost
     if ($borrower->{'lost'} ==1){push (@traps_set,"LOST");}
@@ -219,18 +186,18 @@ sub checktraps {
     #check if borrower has overdue items
     #call overdue checker
     my $odues = &C4::Circulation::Main::checkoverdues($env,$bornum,$dbh);
-    if ($odues > 0) {push (@traps_set,"ODUES");}  
+    if ($odues > 0) {push (@traps_set,"ODUES");}
     #check if borrower has any items waiting
     my ($nowaiting,$itemswaiting) = &C4::Circulation::Main::checkwaiting($env,$dbh,$bornum);
-    if ($nowaiting > 0) { push (@traps_set,"WAITING"); } 
+    if ($nowaiting > 0) { push (@traps_set,"WAITING"); }
     # FIXME - This should be $traps_set[0], right?
     if (@traps_set[0] ne "" ) {
-      ($issuesallowed,$traps_done,$amount,$odues) = 
+      ($issuesallowed,$traps_done,$amount,$odues) =
          process_traps($env,$dbh,$bornum,$borrower,
         $amount,$odues,\@traps_set,$itemswaiting);
     } else {
       $traps_done = "DONE";
-    }   
+    }
   }
   return ($issuesallowed, $odues,$amount);
 }
@@ -241,7 +208,7 @@ sub process_traps {
   my $x = 0;
   my %traps;
   while (@$traps_set[$x] ne "") {
-    $traps{@$traps_set[$x]} = 1; 
+    $traps{@$traps_set[$x]} = 1;
     $x++;
   }
   my $traps_done;
@@ -251,7 +218,7 @@ sub process_traps {
     $trapact = &trapscreen($env,$bornum,$borrower,$amount,$traps_set);
     if ($trapact eq "CHARGES") {
       C4::Accounts::reconcileaccount($env,$dbh,$bornum,$amount,$borrower,$odues);
-      ($odues,$issues,$amount)=borrdata2($env,$bornum);          
+      ($odues,$issues,$amount)=borrdata2($env,$bornum);
       if ($amount <= 0) {
         $traps{'CHARGES'} = 0;
         my @newtraps;
@@ -283,8 +250,8 @@ sub process_traps {
       }
     } elsif  ($trapact eq "NOTES") {
       my $notes = trapsnotes($env,$bornum,$borrower,$amount);
-      if ($notes ne $borrower->{'borrowernotes'}) { 
-        my $query = "update borrowers set borrowernotes = '$notes' 
+      if ($notes ne $borrower->{'borrowernotes'}) {
+        my $query = "update borrowers set borrowernotes = '$notes'
           where borrowernumber = $bornum";
         my $sth = $dbh->prepare($query);
        $sth->execute();
@@ -300,8 +267,8 @@ sub process_traps {
            push @newtraps,$traps_set->[$x];
          }
          $x++;
-        }                 
-        $traps_set = \@newtraps;                                                     
+        }
+        $traps_set = \@newtraps;
       }
     }
     my $notr = @$traps_set;
@@ -346,7 +313,7 @@ sub Borenq {
     }
   }
   return $reason;
-}  
+}
 
 sub modifyuser {
   my ($env,$borrower) = @_;
@@ -383,7 +350,7 @@ Allocates a new, unused borrower number, and returns it.
 =cut
 #'
 # FIXME - This is identical to C4::Search::NewBorrowerNumber.
-# Pick one (preferably this one) and stick with it.  
+# Pick one (preferably this one) and stick with it.
 
 # FIXME - Race condition: this function just says what the next unused
 # number is, but doesn't allocate it. Hence, two clients adding
@@ -408,7 +375,7 @@ sub NewBorrowerNumber {
 sub findguarantees{
   my ($bornum)=@_;
   my $dbh = C4::Context->dbh;
-  my $query="select cardnumber,borrowernumber from borrowers where 
+  my $query="select cardnumber,borrowernumber from borrowers where
   guarantor='$bornum'";
   my $sth=$dbh->prepare($query);
   $sth->execute;
@@ -421,4 +388,3 @@ sub findguarantees{
   $sth->finish;
   return($i,\@dat);
 }
-END { }       # module clean-up code here (global destructor)