From 6897cec04dd39bf2758c8f5dc5994a0a4bd0894b Mon Sep 17 00:00:00 2001 From: tonnesen Date: Thu, 20 Jun 2002 18:56:52 +0000 Subject: [PATCH] Most of these merges are just removing unused parts of the perl modules. --- C4/Accounts.pm | 42 ++---------------------------------------- C4/Accounts2.pm | 52 ++++++++-------------------------------------------- C4/Circmain.pm | 38 ++------------------------------------ C4/Circulation.pm | 39 ++------------------------------------- C4/Format.pm | 38 ++------------------------------------ C4/InterfaceCDK.pm | 43 +++---------------------------------------- C4/Koha.pm | 54 +++++++++++++++++++++++++++++++++++++++++------------- C4/Maintainance.pm | 39 ++------------------------------------- C4/Print.pm | 39 ++------------------------------------- C4/Security.pm | 40 +--------------------------------------- C4/Stats.pm | 40 +--------------------------------------- C4/Stock.pm | 38 ++------------------------------------ 12 files changed, 68 insertions(+), 434 deletions(-) diff --git a/C4/Accounts.pm b/C4/Accounts.pm index 35cd048cdc..e0386f024e 100755 --- a/C4/Accounts.pm +++ b/C4/Accounts.pm @@ -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)=@_; } diff --git a/C4/Accounts2.pm b/C4/Accounts2.pm index c33a36aca4..4bbd9dcb6f 100755 --- a/C4/Accounts2.pm +++ b/C4/Accounts2.pm @@ -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; } diff --git a/C4/Circmain.pm b/C4/Circmain.pm index b3adbcaf2e..be691c186b 100755 --- a/C4/Circmain.pm +++ b/C4/Circmain.pm @@ -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)=@_; diff --git a/C4/Circulation.pm b/C4/Circulation.pm index d3719eb917..4b602c0348 100755 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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)=@_; diff --git a/C4/Format.pm b/C4/Format.pm index d1e41b3da6..17175562f7 100755 --- a/C4/Format.pm +++ b/C4/Format.pm @@ -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 diff --git a/C4/InterfaceCDK.pm b/C4/InterfaceCDK.pm index ce35380df4..592132dee6 100755 --- a/C4/InterfaceCDK.pm +++ b/C4/InterfaceCDK.pm @@ -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 { diff --git a/C4/Koha.pm b/C4/Koha.pm index 1e27a089b4..eae17c4707 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -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 + ðnicitycategories $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 diff --git a/C4/Maintainance.pm b/C4/Maintainance.pm index d400536858..a520cfcf2b 100644 --- a/C4/Maintainance.pm +++ b/C4/Maintainance.pm @@ -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)=@_; diff --git a/C4/Print.pm b/C4/Print.pm index 5abb636ed4..f20e523541 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -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)=@_; diff --git a/C4/Security.pm b/C4/Security.pm index ce8b2fc048..36f4b1a1d0 100644 --- a/C4/Security.pm +++ b/C4/Security.pm @@ -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; diff --git a/C4/Stats.pm b/C4/Stats.pm index 4fe513627d..c973e8a08f 100644 --- a/C4/Stats.pm +++ b/C4/Stats.pm @@ -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 diff --git a/C4/Stock.pm b/C4/Stock.pm index 10fb1e1e02..3e83b1f21b 100644 --- a/C4/Stock.pm +++ b/C4/Stock.pm @@ -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) + -- 2.11.0