Most of these merges are just removing unused parts of the perl modules.
authortonnesen <tonnesen>
Thu, 20 Jun 2002 18:56:52 +0000 (18:56 +0000)
committertonnesen <tonnesen>
Thu, 20 Jun 2002 18:56:52 +0000 (18:56 +0000)
12 files changed:
C4/Accounts.pm
C4/Accounts2.pm
C4/Circmain.pm
C4/Circulation.pm
C4/Format.pm
C4/InterfaceCDK.pm
C4/Koha.pm
C4/Maintainance.pm
C4/Print.pm
C4/Security.pm
C4/Stats.pm
C4/Stock.pm

index 35cd048..e0386f0 100755 (executable)
@@ -1,7 +1,4 @@
-package C4::Accounts; #asummes C4/Accounts
-
-#requires DBI.pm to be installed
-#uses DBD:Pg
+package C4::Accounts; #assumes C4/Accounts
 
 use strict;
 require Exporter;
@@ -12,48 +9,13 @@ use C4::Search;
 use C4::Stats;
 use C4::InterfaceCDK;
 use C4::Interface::AccountsCDK;
-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(&checkaccount &reconcileaccount &getnextacctno);
-%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 displayaccounts{
   my ($env)=@_;
 }
index c33a36a..4bbd9dc 100755 (executable)
@@ -1,16 +1,14 @@
-package C4::Accounts2; #asummes C4/Accounts2
-
-#requires DBI.pm to be installed
-#uses DBD:Pg
+package C4::Accounts2; #assumes C4/Accounts2
 
 use strict;
+use warnings;
 require Exporter;
 use DBI;
 use C4::Database;
 use C4::Stats;
 use C4::Search;
 use C4::Circulation::Circ2;
-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;
@@ -18,40 +16,6 @@ $VERSION = 0.01;
 @ISA = qw(Exporter);
 @EXPORT = qw(&recordpayment &fixaccounts &makepayment &manualinvoice
 &getnextacctno);
-%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 displayaccounts{
   my ($env)=@_;
@@ -92,7 +56,7 @@ sub recordpayment{
      $updquery = "insert into accountoffsets 
      (borrowernumber, accountno, offsetaccount,  offsetamount)
      values ($bornumber,$accdata->{'accountno'},$nextaccntno,$newamtos)";
-     my $usth = $dbh->prepare($updquery);
+     $usth = $dbh->prepare($updquery);
      $usth->execute;
      $usth->finish;
   }
@@ -142,7 +106,7 @@ sub makepayment{
   $updquery = "insert into accountlines 
   (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding)  
   values ($bornumber,$nextaccntno,now(),$payment,'Payment,thanks - $user', 'Pay',0)";
-  my $usth = $dbh->prepare($updquery);
+  $usth = $dbh->prepare($updquery);
   $usth->execute;
   $usth->finish;
   UpdateStats($env,$user,'payment',$amount,'','','',$bornumber);
@@ -295,7 +259,7 @@ sub fixcredit{
      $updquery = "insert into accountoffsets 
      (borrowernumber, accountno, offsetaccount,  offsetamount)
      values ($bornumber,$accdata->{'accountno'},$nextaccntno,$newamtos)";
-     my $usth = $dbh->prepare($updquery);
+     $usth = $dbh->prepare($updquery);
      $usth->execute;
      $usth->finish;
   }
@@ -326,7 +290,7 @@ sub fixcredit{
      $updquery = "insert into accountoffsets 
      (borrowernumber, accountno, offsetaccount,  offsetamount)
      values ($bornumber,$accdata->{'accountno'},$nextaccntno,$newamtos)";
-     my $usth = $dbh->prepare($updquery);
+     $usth = $dbh->prepare($updquery);
      $usth->execute;
      $usth->finish;
   }
@@ -379,7 +343,7 @@ sub refund{
      $updquery = "insert into accountoffsets 
      (borrowernumber, accountno, offsetaccount,  offsetamount)
      values ($bornumber,$accdata->{'accountno'},$nextaccntno,$newamtos)";
-     my $usth = $dbh->prepare($updquery);
+     $usth = $dbh->prepare($updquery);
      $usth->execute;
      $usth->finish;
   }
index b3adbca..be691c1 100755 (executable)
@@ -1,4 +1,4 @@
-package C4::Circmain; #asummes C4/Circulation
+package C4::Circmain; #assumes C4/Circulation
 
 #package to deal with circulation 
 
@@ -15,47 +15,13 @@ use C4::Reserves;
 use C4::InterfaceCDK;
 use C4::Security;
 
-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(&Start_circ);
-%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 Start_circ{
   my ($env)=@_;
index d3719eb..4b602c0 100755 (executable)
@@ -1,4 +1,4 @@
-package C4::Circulation; #asummes C4/Circulation
+package C4::Circulation; #assumes C4/Circulation
 
 #package to deal with circulation 
 
@@ -14,48 +14,13 @@ use C4::Reserves;
 #use C4::Interface;
 use C4::Security;
 
-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(&Start_circ &scanborrower);
-#@EXPORT = qw(&Start_circ checkoverdues);
-%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 Start_circ{
   my ($env)=@_;
index d1e41b3..1717556 100755 (executable)
@@ -1,50 +1,16 @@
-package C4::Format; #asummes C4/Format
+package C4::Format; #assumes C4/Format
 
 use strict;
 require Exporter;
 
 
-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(&fmtstr &fmtdec);
-%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 fmtstr {
   # format (space pad) a string
index ce35380..592132d 100755 (executable)
@@ -1,5 +1,4 @@
-
-package C4::InterfaceCDK; #asummes C4/InterfaceCDK
+package C4::InterfaceCDK; #assumes C4/InterfaceCDK
 
 #uses Newt
 use C4::Format;
@@ -13,7 +12,7 @@ use C4::Circulation::Renewals;
 
 require Exporter;
 use DBI;
-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;
@@ -23,45 +22,9 @@ $VERSION = 0.01;
 &textbox &menu &issuewindow &msg_yn &msg_ny &borrower_dialog &debug_msg &error_msg
 &info_msg &selborrower &returnwindow &logondialog &borrowerwindow &titlepanel
 &borrbind &borrfill &preeborr &borrowerbox &brmenu &prmenu);
-%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 se them.
-               
-# file-private lexicals go here
-my $priv_var    = '';
-my %secret_hash = ();
 
-#defining keystrokes used for screens
-my $key_tab  = chr(9);
-my $key_ctlr = chr(18);
-my $lastval = $key_ctlr;
-
-# 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 suspend_cb {
-
+    # is this planned for something?
 }
       
 sub startint {
index 1e27a08..eae17c4 100644 (file)
@@ -2,6 +2,7 @@ package C4::Koha;
 
 use strict;
 require Exporter;
+use C4::Database;
 
 use vars qw($VERSION @ISA @EXPORT);
   
@@ -10,6 +11,8 @@ $VERSION = 0.01;
 @ISA = qw(Exporter);
 @EXPORT = qw(&slashifyDate
             &fixEthnicity
+            &borrowercategories
+            &ethnicitycategories
             $DEBUG); 
 
 use vars qw();
@@ -23,22 +26,47 @@ sub slashifyDate {
     return("$dateOut[2]/$dateOut[1]/$dateOut[0]")
 }
 
-sub fixEthnicity($) { # a temporary fix ethnicity, it should really be handled
-                      # in Search.pm or the DB ... 
+sub fixEthnicity($) { 
 
     my $ethnicity = shift;
-    if ($ethnicity eq 'maori') {
-       $ethnicity = 'Maori';
-    } elsif ($ethnicity eq 'european') {
-       $ethnicity = 'European/Pakeha';
-    } elsif ($ethnicity eq 'pi') {
-       $ethnicity = 'Pacific Islander'
-    } elsif ($ethnicity eq 'asian') {
-       $ethnicity = 'Asian';
+    my $dbh=C4Connect;
+    my $sth=$dbh->prepare("Select name from ethnicity where code = ?");
+    $sth->execute($ethnicity);
+    my $data=$sth->fetchrow_hashref;
+    $sth->finish;
+    $dbh->disconnect;
+    return $data->{'name'};
+}
+
+sub borrowercategories {
+    my $dbh=C4Connect;
+    my $sth=$dbh->prepare("Select categorycode,description from categories order by description");
+    $sth->execute;
+    my %labels;
+    my @codes;
+    while (my $data=$sth->fetchrow_hashref){
+      push @codes,$data->{'categorycode'};
+      $labels{$data->{'categorycode'}}=$data->{'description'};
     }
-    return $ethnicity;
+    $sth->finish;
+    $dbh->disconnect;
+    return(\@codes,\%labels);
 }
 
+sub ethnicitycategories {
+    my $dbh=C4Connect;
+    my $sth=$dbh->prepare("Select code,name from ethnicity order by name");
+    $sth->execute;
+    my %labels;
+    my @codes;
+    while (my $data=$sth->fetchrow_hashref){
+      push @codes,$data->{'code'};
+      $labels{$data->{'code'}}=$data->{'name'};
+    }
+    $sth->finish;
+    $dbh->disconnect;
+    return(\@codes,\%labels);
+}
 
 1;
 __END__
@@ -53,8 +81,8 @@ Koha - Perl Module containing convenience functions for Koha scripts
 
 
   $date = slashifyDate("01-01-2002")
-
-
+  $ethnicity=fixEthnicity('asian');
+  ($categories,$labels)=borrowercategories();
 
 =head1 DESCRIPTION
 
index d400536..a520cfc 100644 (file)
@@ -1,4 +1,4 @@
-package C4::Maintainance; #asummes C4/Maintainance
+package C4::Maintainance; #assumes C4/Maintainance
 
 #package to deal with marking up output
 
@@ -7,7 +7,7 @@ use C4::Database;
 
 require Exporter;
 
-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;
@@ -15,41 +15,6 @@ $VERSION = 0.01;
 @ISA = qw(Exporter);
 @EXPORT = qw(&listsubjects &updatesub &shiftgroup &deletedbib &undeletebib
 &updatetype);
-%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 listsubjects {
   my ($sub,$num,$offset)=@_;
index 5abb636..f20e523 100644 (file)
@@ -1,51 +1,16 @@
-package C4::Print; #asummes C4/Print.pm
+package C4::Print; #assumes C4/Print.pm
 
 use strict;
 require Exporter;
 #use C4::InterfaceCDK;
 
-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(&remoteprint &printreserve);
-%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 remoteprint {
   my ($env,$items,$borrower)=@_;
index ce8b2fc..36f4b1a 100644 (file)
@@ -1,7 +1,4 @@
-package C4::Security; #asummes C4/Security
-
-#requires DBI.pm to be installed
-#uses DBD:Pg
+package C4::Security; #assumes C4/Security
 
 use strict;
 require Exporter;
@@ -15,42 +12,7 @@ $VERSION = 0.01;
 
 @ISA = qw(Exporter);
 @EXPORT = qw(&Login &CheckAccess);
-%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 Login {
   my ($env)=@_;
   my $dbh=C4Connect;
index 4fe5136..c973e8a 100644 (file)
@@ -1,7 +1,4 @@
-package C4::Stats; #asummes C4/Stats
-
-#requires DBI.pm to be installed
-#uses DBD:Pg
+package C4::Stats; #assumes C4/Stats
 
 use strict;
 require Exporter;
@@ -15,41 +12,6 @@ $VERSION = 0.01;
 @ISA = qw(Exporter);
 @EXPORT = qw(&UpdateStats &statsreport &Count &Overdues &TotalOwing
 &TotalPaid &getcharges &Getpaidbranch &unfilledreserves);
-%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 UpdateStats {
   #module to insert stats data into stats table
index 10fb1e1..3e83b1f 100644 (file)
@@ -1,4 +1,4 @@
-package C4::Stock; #asummes C4/Stock.pm
+package C4::Stock; #assumes C4/Stock.pm
 
 use strict;
 require Exporter;
@@ -11,41 +11,6 @@ $VERSION = 0.01;
 
 @ISA = qw(Exporter);
 @EXPORT = qw(&stockreport);
-%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 stockreport {
   my $dbh=C4Connect;
@@ -69,3 +34,4 @@ sub stockreport {
 END { }       # module clean-up code here (global destructor)
   
     
+