From fbd7f81044b97cdb4274529aa97207ae378ca162 Mon Sep 17 00:00:00 2001 From: arensb Date: Tue, 1 Oct 2002 13:22:02 +0000 Subject: [PATCH] Added an incomplete POD, as well as some FIXME comments (which, as it turns out, might not be necessary after all). --- C4/Acquisitions.pm | 538 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 520 insertions(+), 18 deletions(-) diff --git a/C4/Acquisitions.pm b/C4/Acquisitions.pm index c03c10f8a8..f3637a1d61 100644 --- a/C4/Acquisitions.pm +++ b/C4/Acquisitions.pm @@ -18,6 +18,11 @@ package C4::Acquisitions; #assumes C4/Acquisitions.pm # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA +# *** +# NOTE: This module is deprecated in Koha 1.3.x, and will shortly be +# deleted. +# *** + use strict; require Exporter; use C4::Database; @@ -27,6 +32,24 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); # set the version for version checking $VERSION = 0.01; +=head1 NAME + +C4::Acquisitions - FIXME + +=head1 SYNOPSIS + + use C4::Acquisitions; + +=head1 DESCRIPTION + +FIXME + +=head1 FUNCTIONS + +=over 2 + +=cut + @ISA = qw(Exporter); @EXPORT = qw(&getorders &bookseller &breakdown &basket &newbasket &bookfunds &ordersearch &newbiblio &newbiblioitem &newsubject &newsubtitle &neworder @@ -44,20 +67,21 @@ $VERSION = 0.01; # your exported package globals go here, # as well as any optionally exported functions -@EXPORT_OK = qw($Var1 %Hashit); +@EXPORT_OK = qw($Var1 %Hashit); # FIXME - Never used # non-exported package globals go here -use vars qw(@more $stuff); +use vars qw(@more $stuff); # FIXME - Never used # initalize package globals, first exported ones - +# FIXME - Never used my $Var1 = ''; my %Hashit = (); # then the others (which are still accessible as $Some::Module::stuff) +# FIXME - Never used my $stuff = ''; my @more = (); @@ -65,9 +89,11 @@ my @more = (); # the functions below that use them. # file-private lexicals go here +# FIXME - Never used my $priv_var = ''; my %secret_hash = (); +# FIXME - Never used # here's a file-private function as a closure, # callable as &$priv_func; it cannot be prototyped. my $priv_func = sub { @@ -76,6 +102,40 @@ my $priv_func = sub { # make all your functions, whether exported or not; +=item getorders + + ($count, $orders) = &getorders($booksellerid); + +Finds pending orders from the bookseller with the given ID. Ignores +completed and cancelled orders. + +C<$count> is the number of elements in C<@{$orders}>. + +C<$orders> is a reference-to-array; each element is a +reference-to-hash with the following fields: + +=over 4 + +=item C + +Gives the number of orders in with this basket number. + +=item C + +=item C + +=item C + +These give the value of the corresponding field in the aqorders table +of the Koha database. + +=back + +Results are ordered from most to least recent. + +=cut +#' +# FIXME - This exact function already exists in C4::Catalogue sub getorders { my ($supplierid)=@_; my $dbh=C4Connect; @@ -98,6 +158,9 @@ sub getorders { return ($i,\@results); } +# Only used internally +# FIXME - This is the same as &C4::Biblio::itemcount, but not +# the same as &C4::Search::itemcount sub itemcount{ my ($biblio)=@_; my $dbh=C4Connect; @@ -111,6 +174,22 @@ sub itemcount{ return($data->{'count(*)'}); } +=item getorder + + ($order, $ordernumber) = &getorder($biblioitemnumber, $biblionumber); + +Looks up the order with the given biblionumber and biblioitemnumber. + +Returns a two-element array. C<$ordernumber> is the order number. +C<$order> is a reference-to-hash describing the order; its keys are +fields from the biblio, biblioitems, aqorders, and aqorderbreakdown +tables of the Koha database. + +=cut +#' +# FIXME - There are functions &getorder and &getorders. Isn't this +# somewhat likely to cause confusion? +# FIXME - Almost the exact same function is already in C4::Catalogue sub getorder{ my ($bi,$bib)=@_; my $dbh=C4Connect; @@ -127,6 +206,20 @@ sub getorder{ return ($order,$ordnum->{'ordernumber'}); } +=item getsingleorder + + $order = &getsingleorder($ordernumber); + +Looks up an order by order number. + +Returns a reference-to-hash describing the order. The keys of +C<$order> are fields from the biblio, biblioitems, aqorders, and +aqorderbreakdown tables of the Koha database. + +=cut +#' +# FIXME - This is practically the same function as +# &C4::Catalogue::getsingleorder and &C4::Biblio::getsingleorder. sub getsingleorder { my ($ordnum)=@_; my $dbh=C4Connect; @@ -143,6 +236,20 @@ sub getsingleorder { return($data); } +=item invoice + + ($count, @results) = &invoice($booksellerinvoicenumber); + +Looks up orders by invoice number. + +Returns an array. C<$count> is the number of elements in C<@results>. +C<@results> is an array of references-to-hash; the keys of each +elements are fields from the aqorders, biblio, and biblioitems tables +of the Koha database. + +=cut +#' +# FIXME - This exact function is already in C4::Catalogue sub invoice { my ($invoice)=@_; my $dbh=C4Connect; @@ -163,6 +270,23 @@ sub invoice { return($i,@results); } +=item getallorders + + ($count, @results) = &getallorders($booksellerid); + +Looks up all of the pending orders from the supplier with the given +bookseller ID. Ignores cancelled orders. + +C<$count> is the number of elements in C<@results>. C<@results> is an +array of references-to-hash. The keys of each element are fields from +the aqorders, biblio, and biblioitems tables of the Koha database. + +C<@results> is sorted alphabetically by book title. + +=cut +#' +# FIXME - Almost (but not quite) the same function appears in C4::Catalogue +# That one only lists incomplete orders. sub getallorders { #gets all orders from a certain supplier, orders them alphabetically my ($supid)=@_; @@ -187,6 +311,8 @@ sub getallorders { return($i,@results); } +# FIXME - There's a getrecorders in C4::Catalogue +# FIXME - Never used (neither is the other one, actually) sub getrecorders { #gets all orders from a certain supplier, orders them alphabetically my ($supid)=@_; @@ -213,6 +339,42 @@ sub getrecorders { return($i,@results); } +=item ordersearch + + ($count, @results) = &ordersearch($search, $biblionumber, $complete); + +Searches for orders. + +C<$search> may take one of several forms: if it is an ISBN, +C<&ordersearch> returns orders with that ISBN. If C<$search> is an +order number, C<&ordersearch> returns orders with that order number +and biblionumber C<$biblionumber>. Otherwise, C<$search> is considered +to be a space-separated list of search terms; in this case, all of the +terms must appear in the title (matching the beginning of title +words). + +If C<$complete> is C, the results will include only completed +orders. In any case, C<&ordersearch> ignores cancelled orders. + +C<&ordersearch> returns an array. C<$count> is the number of elements +in C<@results>. C<@results> is an array of references-to-hash with the +following keys: + +=over 4 + +=item C + +=item C + +=item C + +=item C + +=back + +=cut +#' +# FIXME - The same function (modulo whitespace) appears in C4::Catalogue sub ordersearch { my ($search,$biblio,$catview)=@_; my $dbh=C4Connect; @@ -262,7 +424,20 @@ sub ordersearch { return($i,@results); } +=item bookseller + + ($count, @results) = &bookseller($searchstring); + +Looks up a book seller. C<$searchstring> may be either a book seller +ID, or a string to look for in the book seller's name. + +C<$count> is the number of elements in C<@results>. C<@results> is an +array of references-to-hash, whose keys are the fields of of the +aqbooksellers table in the Koha database. +=cut +#' +# FIXME - This function appears in C4::Catalogue sub bookseller { my ($searchstring)=@_; my $dbh=C4Connect; @@ -281,6 +456,19 @@ sub bookseller { return($i,@results); } +=item breakdown + + ($count, $results) = &breakdown($ordernumber); + +Looks up an order by order ID, and returns its breakdown. + +C<$count> is the number of elements in C<$results>. C<$results> is a +reference-to-array; its elements are references-to-hash, whose keys +are the fields of the aqorderbreakdown table in the Koha database. + +=cut +#' +# FIXME - This function appears in C4::Catalogue. sub breakdown { my ($id)=@_; my $dbh=C4Connect; @@ -298,6 +486,23 @@ sub breakdown { return($i,\@results); } +=item basket + + ($count, @orders) = &basket($basketnumber, $booksellerID); + +Looks up the pending (non-cancelled) orders with the given basket +number. If C<$booksellerID> is non-empty, only orders from that seller +are returned. + +C<&basket> returns a two-element array. C<@orders> is an array of +references-to-hash, whose keys are the fields from the aqorders, +biblio, and biblioitems tables in the Koha database. C<$count> is the +number of elements in C<@orders>. + +=cut +#' +# FIXME - Almost the same function (with less error-checking) appears in +# C4::Catalogue.pm sub basket { my ($basketno,$supplier)=@_; my $dbh=C4Connect; @@ -325,6 +530,25 @@ sub basket { return($i,@results); } +=item newbasket + + $basket = &newbasket(); + +Finds the next unused basket number in the aqorders table of the Koha +database, and returns it. + +=cut +#' +# FIXME - There's a race condition here: +# A calls &newbasket +# B calls &newbasket (gets the same number as A) +# A updates the basket +# B updates the basket, and clobbers A's result. +# A better approach might be to create a dummy order (with, say, +# requisitionedby == "Dummy-$$" or notes == "dummy