package C4::Catalogue; #assumes C4/Acquisitions.pm # Continue working on updateItem!!!!!! # # updateItem is looking not bad. Need to add addSubfield and deleteSubfield # functions # # Trying to track down $dbh's that aren't disconnected.... # # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. # # Koha is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # Koha is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA use strict; require Exporter; use C4::Context; use MARC::Record; use C4::Biblio; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); # set the version for version checking $VERSION = 0.01; =head1 NAME C4::Catalogue - FIXME =head1 SYNOPSIS use C4::Catalogue; =head1 DESCRIPTION FIXME =head1 FUNCTIONS =over 2 =cut @ISA = qw(Exporter); @EXPORT = qw( &basket &newbasket &getorders &getallorders &getrecorders &getorder &neworder &delorder &ordersearch &modorder &getsingleorder &invoice &receiveorder &updaterecorder &newordernum &bookfunds &bookfundbreakdown &updatecost &curconvert &getcurrencies &updatecurrencies &getcurrency &findall &needsmod &branches &updatesup &insertsup &bookseller &breakdown &checkitems &websitesearch &addwebsite &updatewebsite &deletewebsite ); %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); # FIXME - Unused # non-exported package globals go here use vars qw(@more $stuff); # FIXME - Unused # initalize package globals, first exported ones # FIXME - Unused my $Var1 = ''; my %Hashit = (); # then the others (which are still accessible as $Some::Module::stuff) # FIXME - Unused my $stuff = ''; my @more = (); # all file-scoped lexicals must be created before # the functions below that use them. # file-private lexicals go here # FIXME - Unused my $priv_var = ''; my %secret_hash = (); # here's a file-private function as a closure, # callable as &$priv_func; it cannot be prototyped. # FIXME - Unused my $priv_func = sub { # stuff goes here. }; # make all your functions, whether exported or not; # # # # BASKETS # # # =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 #' sub basket { my ($basketno,$supplier)=@_; my $dbh = C4::Context->dbh; my $query="Select *,biblio.title from aqorders,biblio,biblioitems where basketno='$basketno' and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber =aqorders.biblioitemnumber and (datecancellationprinted is NULL or datecancellationprinted = '0000-00-00')"; if ($supplier ne ''){ $query.=" and aqorders.booksellerid='$supplier'"; } $query.=" group by aqorders.ordernumber"; my $sth=$dbh->prepare($query); $sth->execute; my @results; # print $query; my $i=0; while (my $data=$sth->fetchrow_hashref){ $results[$i]=$data; $i++; } $sth->finish; 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