[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/C4/Circulation Main.pm,1.6,1.7
From: |
Andrew Arensburger |
Subject: |
[Koha-cvs] CVS: koha/C4/Circulation Main.pm,1.6,1.7 |
Date: |
Sat, 12 Oct 2002 23:21:22 -0700 |
Update of /cvsroot/koha/koha/C4/Circulation
In directory usw-pr-cvs1:/tmp/cvs-serv22108
Modified Files:
Main.pm
Log Message:
Added magic RCS comment.
Added some FIXME comments.
Deleted unused variables.
Added POD.
Removed unused finalizer.
Index: Main.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Main.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Main.pm 7 Oct 2002 00:53:05 -0000 1.6
--- Main.pm 13 Oct 2002 06:21:20 -0000 1.7
***************
*** 1,5 ****
! package C4::Circulation::Main; #assumes C4/Circulation/Main
! #package to deal with circulation
--- 1,7 ----
! package C4::Circulation::Main;
! # $Id$
!
! #package to deal with circulation
***************
*** 42,88 ****
use C4::Security;
! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
!
# set the version for version checking
$VERSION = 0.01;
!
@ISA = qw(Exporter);
! @EXPORT = qw(&pastitems &checkoverdues &previousissue
&checkreserve &checkwaiting &scanbook &scanborrower &getbranch &getprinter);
- %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 getbranch {
my ($env) = @_;
--- 44,79 ----
use C4::Security;
! use vars qw($VERSION @ISA @EXPORT);
!
# set the version for version checking
$VERSION = 0.01;
!
@ISA = qw(Exporter);
! @EXPORT = qw(&pastitems &checkoverdues &previousissue
&checkreserve &checkwaiting &scanbook &scanborrower &getbranch &getprinter);
+ =head1 NAME
+
+ C4::Circulation::Main - Koha circulation desk functions
+
+ =head1 SYNOPSIS
+
+ use C4::Circulation::Main;
+
+ =head1 DESCRIPTION
+
+ This module provides functions useful to the circulation desk,
+ primarily for checking reserves and overdue items.
+
+ =head1 FUNCTIONS
+
+ =over 2
+
+ =cut
+
+ # FIXME - This is only used in C4::Circmain and telnet/startint.pl,
+ # which look obsolete. Presumably this means this function is obsolete
+ # as well.
+ # Otherwise, it needs a POD.
sub getbranch {
my ($env) = @_;
***************
*** 101,105 ****
$env->{'branchcode'}=$data->{'branchcode'};
}
! my $query = "select * from branches
where branchcode = '$env->{'branchcode'}'";
$sth = $dbh->prepare($query);
--- 92,96 ----
$env->{'branchcode'}=$data->{'branchcode'};
}
! my $query = "select * from branches
where branchcode = '$env->{'branchcode'}'";
$sth = $dbh->prepare($query);
***************
*** 111,114 ****
--- 102,109 ----
}
+ # FIXME - This is only used in C4::Circmain and telnet/startint.pl,
+ # which look obsolete. Presumably this means this function is obsolete
+ # as well.
+ # Otherwise, it needs a POD.
sub getprinter {
my ($env) = @_;
***************
*** 130,136 ****
$sth->finish;
}
!
# FIXME - This is not the same as &C4::Circulation::pastitems, though
# the two appear to share some code.
sub pastitems{
#Get list of all items borrower has currently on issue
--- 125,135 ----
$sth->finish;
}
!
# FIXME - This is not the same as &C4::Circulation::pastitems, though
# the two appear to share some code.
+ # FIXME - This function is called in &C4::Circulation::Issues::Issue
+ # and in telnet/borrwraper.pl, both of which look obsolete. Presumably
+ # this means this function is obsolete as well.
+ # Otherwise, it needs a POD.
sub pastitems{
#Get list of all items borrower has currently on issue
***************
*** 155,163 ****
--- 154,181 ----
}
+ =item checkoverdues
+
+ $num_items = &checkoverdues($env, $borrowernumber, $dbh);
+
+ Returns the number of overdue books a patron has.
+
+ C<$env> is ignored.
+
+ C<$borrowernumber> is the patron's borrower number.
+
+ C<$dbh> is a DBI handle to the Koha database.
+
+ =cut
+ #'
sub checkoverdues{
#checks whether a borrower has overdue items
+ # FIXME - Use C4::Context->dbh instead of getting $dbh as an argument
my ($env,$bornum,$dbh)address@hidden;
+ # FIXME - This is what POSIX::strftime is for.
my @datearr = localtime;
my $today = ($datearr[5] + 1900)."-".($datearr[4]+1)."-".$datearr[3];
+ # FIXME - MySQL can figure out what today is, so there's no need
+ # to calculate that separately. Just use
+ # ... date_due < curdate()
my $query = "Select count(*) from issues where borrowernumber=$bornum and
returndate is NULL and date_due < '$today'";
***************
*** 170,180 ****
# FIXME - This is quite similar to &C4::Circulation::previousissue
sub previousissue {
my ($env,$itemnum,$dbh,$bornum)address@hidden;
! my $sth=$dbh->prepare("Select
firstname,surname,issues.borrowernumber,cardnumber,returndate
! from issues,borrowers where
issues.itemnumber='$itemnum' and
! issues.borrowernumber=borrowers.borrowernumber
and issues.returndate is NULL");
$sth->execute;
--- 188,200 ----
# FIXME - This is quite similar to &C4::Circulation::previousissue
+ # FIXME - Never used. Obsolete, presumably.
+ # Otherwise, it needs a POD.
sub previousissue {
my ($env,$itemnum,$dbh,$bornum)address@hidden;
! my $sth=$dbh->prepare("Select
firstname,surname,issues.borrowernumber,cardnumber,returndate
! from issues,borrowers where
issues.itemnumber='$itemnum' and
! issues.borrowernumber=borrowers.borrowernumber
and issues.returndate is NULL");
$sth->execute;
***************
*** 208,214 ****
$canissue = "N";
}
! }
} else {
! my $text="Issued to $borrower->{'firstname'} $borrower->{'surname'}
($borrower->{'cardnumber'})";
my $resp = C4::InterfaceCDK::msg_yn($env,$text,"Mark as returned?");
if ( $resp eq "Y") {
--- 228,234 ----
$canissue = "N";
}
! }
} else {
! my $text="Issued to $borrower->{'firstname'} $borrower->{'surname'}
($borrower->{'cardnumber'})";
my $resp = C4::InterfaceCDK::msg_yn($env,$text,"Mark as returned?");
if ( $resp eq "Y") {
***************
*** 218,236 ****
}
}
! }
return($borrower->{'borrowernumber'},$canissue,$newdate);
}
sub checkreserve{
! # Check for reserves for biblio
my ($env,$dbh,$itemnum)address@hidden;
my $resbor = "";
! my $query = "select * from reserves,items
where (items.itemnumber = '$itemnum')
and (reserves.cancellationdate is NULL)
and (items.biblionumber = reserves.biblionumber)
and ((reserves.found = 'W')
! or (reserves.found is null))
order by priority";
my $sth = $dbh->prepare($query);
--- 238,282 ----
}
}
! }
return($borrower->{'borrowernumber'},$canissue,$newdate);
}
+ =item checkreserve
+
+ ($borrowernumber, $reserve) = &checkreserve($env, $dbh, $itemnumber);
+
+ C<$env> is ignored.
+
+ C<$dbh> is a DBI handle to the Koha database.
+ C<$itemnumber> is the number of the item to find.
+
+ C<&checkreserve> returns two values:
+
+ C<$borrowernumber> is the borrower number of the patron for whom the
+ book is reserved, or the empty string. I can't tell when it returns a
+ number and when it returns a string, nor what it means.
+
+ C<$reserve> describes the reserved item. It is a reference-to-hash
+ whose keys are the fields of the reserves and items tables of the Koha
+ database.
+
+ =cut
+ #'
sub checkreserve{
! # Check for reserves for biblio
! # FIXME - Use C4::Context->dbh to get $dbh, instead of passing it
! # on the argument list.
my ($env,$dbh,$itemnum)address@hidden;
my $resbor = "";
! # Find this item in the reserves.
! # Apparently reserves.found=='W' means "Waiting".
! # FIXME - Is it necessary to get every field from both tables?
! my $query = "select * from reserves,items
where (items.itemnumber = '$itemnum')
and (reserves.cancellationdate is NULL)
and (items.biblionumber = reserves.biblionumber)
and ((reserves.found = 'W')
! or (reserves.found is null))
order by priority";
my $sth = $dbh->prepare($query);
***************
*** 240,263 ****
$resrec=$data;
my $const = $data->{'constrainttype'};
! if ($const eq "a") {
! $resbor = $data->{'borrowernumber'};
} else {
my $found = 0;
! my $cquery = "select * from reserveconstraints,items
! where (borrowernumber='$data->{'borrowernumber'}')
and reservedate='$data->{'reservedate'}'
and reserveconstraints.biblionumber='$data->{'biblionumber'}'
! and (items.itemnumber=$itemnum and
items.biblioitemnumber = reserveconstraints.biblioitemnumber)";
my $csth = $dbh->prepare($cquery);
$csth->execute;
if (my $cdata=$csth->fetchrow_hashref) {$found = 1;}
! if ($const eq 'o') {
if ($found eq 1) {$resbor = $data->{'borrowernumber'};}
} else {
! if ($found eq 0) {$resbor = $data->{'borrowernumber'};}
}
$csth->finish();
! }
}
$sth->finish;
--- 286,309 ----
$resrec=$data;
my $const = $data->{'constrainttype'};
! if ($const eq "a") { # FIXME - What does 'a' mean?
! $resbor = $data->{'borrowernumber'};
} else {
my $found = 0;
! my $cquery = "select * from reserveconstraints,items
! where (borrowernumber='$data->{'borrowernumber'}')
and reservedate='$data->{'reservedate'}'
and reserveconstraints.biblionumber='$data->{'biblionumber'}'
! and (items.itemnumber=$itemnum and
items.biblioitemnumber = reserveconstraints.biblioitemnumber)";
my $csth = $dbh->prepare($cquery);
$csth->execute;
if (my $cdata=$csth->fetchrow_hashref) {$found = 1;}
! if ($const eq 'o') { # FIXME - What does 'o' mean?
if ($found eq 1) {$resbor = $data->{'borrowernumber'};}
} else {
! if ($found eq 0) {$resbor = $data->{'borrowernumber'};}
}
$csth->finish();
! }
}
$sth->finish;
***************
*** 265,268 ****
--- 311,317 ----
}
+ # FIXME - This is only used in C4::Circulation::Borrower, which
+ # appears to be obsolete. Presumably this function is obsolete as
+ # well. Otherwise, it needs a POD.
sub checkwaiting{
# check for reserves waiting
***************
*** 284,287 ****
--- 333,339 ----
# FIXME - This is identical to &C4::Circulation::scanbook
+ # FIXME - This function is only used in tkperl/tkcirc, if anywhere
+ # (it's hard to tell). Presumably it's obsolete.
+ # Otherwise, it needs a POD.
sub scanbook {
my ($env,$interface)address@hidden;
***************
*** 293,305 ****
# FIXME - This is very similar to &C4::Circulation::scanborrower
sub scanborrower {
my ($env,$interface)address@hidden;
#scan barcode
my ($number,$reason,$book)=C4::InterfaceCDK::borrower_dialog($env);
#C4::InterfaceCDK
! $number= $number;
$book=uc $book;
return ($number,$reason,$book);
}
! END { } # module clean-up code here (global destructor)
--- 345,369 ----
# FIXME - This is very similar to &C4::Circulation::scanborrower
+ # FIXME - This is only used in C4::Circulation::Borrower, which
+ # appears to be obsolete. Presumably this function is obsolete as
+ # well.
+ # Otherwise, it needs a POD.
sub scanborrower {
my ($env,$interface)address@hidden;
#scan barcode
my ($number,$reason,$book)=C4::InterfaceCDK::borrower_dialog($env);
#C4::InterfaceCDK
! $number= $number; # FIXME - WTF?
$book=uc $book;
return ($number,$reason,$book);
}
+ 1;
+ __END__
+
+ =back
+
+ =head1 AUTHOR
+
+ Koha Developement team <address@hidden>
! =cut
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/C4/Circulation Main.pm,1.6,1.7,
Andrew Arensburger <=