1 package C4::Acquisitions; #assumes C4/Acquisitions.pm
4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
22 # NOTE: This module is deprecated in Koha 1.3.x, and will shortly be
30 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
32 # set the version for version checking
37 C4::Acquisitions - FIXME
54 @EXPORT = qw(&getorders &bookseller &breakdown &basket &newbasket &bookfunds
55 &ordersearch &newbiblio &newbiblioitem &newsubject &newsubtitle &neworder
56 &newordernum &modbiblio &modorder &getsingleorder &invoice &receiveorder
57 &bookfundbreakdown &curconvert &updatesup &insertsup &newitems &modbibitem
58 &getcurrencies &modsubtitle &modsubject &modaddauthor &moditem &countitems
59 &findall &needsmod &delitem &deletebiblioitem &delbiblio &delorder &branches
60 &getallorders &getrecorders &updatecurrencies &getorder &getcurrency &updaterecorder
61 &updatecost &checkitems &modnote &getitemtypes &getbiblio
62 &getbiblioitembybiblionumber
63 &getbiblioitem &getitemsbybiblioitem &isbnsearch
64 &websitesearch &addwebsite &updatewebsite &deletewebsite);
65 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
67 # your exported package globals go here,
68 # as well as any optionally exported functions
70 @EXPORT_OK = qw($Var1 %Hashit); # FIXME - Never used
73 # non-exported package globals go here
74 use vars qw(@more $stuff); # FIXME - Never used
76 # initalize package globals, first exported ones
83 # then the others (which are still accessible as $Some::Module::stuff)
88 # all file-scoped lexicals must be created before
89 # the functions below that use them.
91 # file-private lexicals go here
97 # here's a file-private function as a closure,
98 # callable as &$priv_func; it cannot be prototyped.
103 # make all your functions, whether exported or not;
107 ($count, $orders) = &getorders($booksellerid);
109 Finds pending orders from the bookseller with the given ID. Ignores
110 completed and cancelled orders.
112 C<$count> is the number of elements in C<@{$orders}>.
114 C<$orders> is a reference-to-array; each element is a
115 reference-to-hash with the following fields:
121 Gives the number of orders in with this basket number.
123 =item C<authorizedby>
129 These give the value of the corresponding field in the aqorders table
130 of the Koha database.
134 Results are ordered from most to least recent.
138 # FIXME - This exact function already exists in C4::Catalogue
142 my $query = "Select count(*),authorisedby,entrydate,basketno from aqorders where
143 booksellerid='$supplierid' and (quantity > quantityreceived or
144 quantityreceived is NULL)
145 and (datecancellationprinted is NULL or datecancellationprinted = '0000-00-00')";
146 $query.=" group by basketno order by entrydate desc";
148 my $sth=$dbh->prepare($query);
152 while (my $data=$sth->fetchrow_hashref){
158 return ($i,\@results);
161 # Only used internally
162 # FIXME - This is the same as &C4::Biblio::itemcount, but not
163 # the same as &C4::Search::itemcount
167 my $query="Select count(*) from items where biblionumber=$biblio";
169 my $sth=$dbh->prepare($query);
171 my $data=$sth->fetchrow_hashref;
174 return($data->{'count(*)'});
179 ($order, $ordernumber) = &getorder($biblioitemnumber, $biblionumber);
181 Looks up the order with the given biblionumber and biblioitemnumber.
183 Returns a two-element array. C<$ordernumber> is the order number.
184 C<$order> is a reference-to-hash describing the order; its keys are
185 fields from the biblio, biblioitems, aqorders, and aqorderbreakdown
186 tables of the Koha database.
190 # FIXME - There are functions &getorder and &getorders. Isn't this
191 # somewhat likely to cause confusion?
192 # FIXME - Almost the exact same function is already in C4::Catalogue
196 my $query="Select ordernumber
198 where biblionumber=? and biblioitemnumber=?";
199 my $sth=$dbh->prepare($query);
200 $sth->execute($bib,$bi);
201 my $ordnum=$sth->fetchrow_hashref;
203 my $order=getsingleorder($ordnum->{'ordernumber'});
206 return ($order,$ordnum->{'ordernumber'});
211 $order = &getsingleorder($ordernumber);
213 Looks up an order by order number.
215 Returns a reference-to-hash describing the order. The keys of
216 C<$order> are fields from the biblio, biblioitems, aqorders, and
217 aqorderbreakdown tables of the Koha database.
221 # FIXME - This is practically the same function as
222 # &C4::Catalogue::getsingleorder and &C4::Biblio::getsingleorder.
226 my $query="Select * from biblio,biblioitems,aqorders,aqorderbreakdown
227 where aqorders.ordernumber=?
228 and biblio.biblionumber=aqorders.biblionumber and
229 biblioitems.biblioitemnumber=aqorders.biblioitemnumber and
230 aqorders.ordernumber=aqorderbreakdown.ordernumber";
231 my $sth=$dbh->prepare($query);
232 $sth->execute($ordnum);
233 my $data=$sth->fetchrow_hashref;
241 ($count, @results) = &invoice($booksellerinvoicenumber);
243 Looks up orders by invoice number.
245 Returns an array. C<$count> is the number of elements in C<@results>.
246 C<@results> is an array of references-to-hash; the keys of each
247 elements are fields from the aqorders, biblio, and biblioitems tables
248 of the Koha database.
252 # FIXME - This exact function is already in C4::Catalogue
256 my $query="Select * from aqorders,biblio,biblioitems where
257 booksellerinvoicenumber='$invoice'
258 and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=
259 aqorders.biblioitemnumber group by aqorders.ordernumber,aqorders.biblioitemnumber";
262 my $sth=$dbh->prepare($query);
264 while (my $data=$sth->fetchrow_hashref){
275 ($count, @results) = &getallorders($booksellerid);
277 Looks up all of the pending orders from the supplier with the given
278 bookseller ID. Ignores cancelled orders.
280 C<$count> is the number of elements in C<@results>. C<@results> is an
281 array of references-to-hash. The keys of each element are fields from
282 the aqorders, biblio, and biblioitems tables of the Koha database.
284 C<@results> is sorted alphabetically by book title.
288 # FIXME - Almost (but not quite) the same function appears in C4::Catalogue
289 # That one only lists incomplete orders.
291 #gets all orders from a certain supplier, orders them alphabetically
294 my $query="Select * from aqorders,biblio,biblioitems where booksellerid='$supid'
295 and (cancelledby is NULL or cancelledby = '')
296 and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=
297 aqorders.biblioitemnumber
298 group by aqorders.biblioitemnumber
303 my $sth=$dbh->prepare($query);
305 while (my $data=$sth->fetchrow_hashref){
314 # FIXME - There's a getrecorders in C4::Catalogue
315 # FIXME - Never used (neither is the other one, actually)
317 #gets all orders from a certain supplier, orders them alphabetically
320 my $query="Select * from aqorders,biblio,biblioitems where booksellerid='$supid'
321 and (cancelledby is NULL or cancelledby = '')
322 and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=
323 aqorders.biblioitemnumber and
324 aqorders.quantityreceived>0
325 and aqorders.datereceived >=now()
326 group by aqorders.biblioitemnumber
331 my $sth=$dbh->prepare($query);
333 while (my $data=$sth->fetchrow_hashref){
344 ($count, @results) = &ordersearch($search, $biblionumber, $complete);
348 C<$search> may take one of several forms: if it is an ISBN,
349 C<&ordersearch> returns orders with that ISBN. If C<$search> is an
350 order number, C<&ordersearch> returns orders with that order number
351 and biblionumber C<$biblionumber>. Otherwise, C<$search> is considered
352 to be a space-separated list of search terms; in this case, all of the
353 terms must appear in the title (matching the beginning of title
356 If C<$complete> is C<yes>, the results will include only completed
357 orders. In any case, C<&ordersearch> ignores cancelled orders.
359 C<&ordersearch> returns an array. C<$count> is the number of elements
360 in C<@results>. C<@results> is an array of references-to-hash with the
377 # FIXME - The same function (modulo whitespace) appears in C4::Catalogue
379 my ($search,$biblio,$catview)=@_;
381 my $query="Select *,biblio.title from aqorders,biblioitems,biblio
382 where aqorders.biblioitemnumber = biblioitems.biblioitemnumber
383 and biblio.biblionumber=aqorders.biblionumber
384 and ((datecancellationprinted is NULL)
385 or (datecancellationprinted = '0000-00-00'))
387 my @data=split(' ',$search);
389 for (my $i=0;$i<$count;$i++){
390 $query.= "(biblio.title like '$data[$i]%' or biblio.title like '% $data[$i]%') and ";
393 $query.=" ) or biblioitems.isbn='$search'
394 or (aqorders.ordernumber='$search' and aqorders.biblionumber='$biblio')) ";
395 if ($catview ne 'yes'){
396 $query.=" and (quantityreceived < quantity or quantityreceived is NULL)";
398 $query.=" group by aqorders.ordernumber";
399 my $sth=$dbh->prepare($query);
404 while (my $data=$sth->fetchrow_hashref){
405 my $sth2=$dbh->prepare("Select * from biblio where
406 biblionumber='$data->{'biblionumber'}'");
408 my $data2=$sth2->fetchrow_hashref;
410 $data->{'author'}=$data2->{'author'};
411 $data->{'seriestitle'}=$data2->{'seriestitle'};
412 $sth2=$dbh->prepare("Select * from aqorderbreakdown where
413 ordernumber=$data->{'ordernumber'}");
415 $data2=$sth2->fetchrow_hashref;
417 $data->{'branchcode'}=$data2->{'branchcode'};
418 $data->{'bookfundid'}=$data2->{'bookfundid'};
429 ($count, @results) = &bookseller($searchstring);
431 Looks up a book seller. C<$searchstring> may be either a book seller
432 ID, or a string to look for in the book seller's name.
434 C<$count> is the number of elements in C<@results>. C<@results> is an
435 array of references-to-hash, whose keys are the fields of of the
436 aqbooksellers table in the Koha database.
440 # FIXME - This function appears in C4::Catalogue
442 my ($searchstring)=@_;
444 my $query="Select * from aqbooksellers where name like '%$searchstring%' or
445 id = '$searchstring'";
446 my $sth=$dbh->prepare($query);
450 while (my $data=$sth->fetchrow_hashref){
461 ($count, $results) = &breakdown($ordernumber);
463 Looks up an order by order ID, and returns its breakdown.
465 C<$count> is the number of elements in C<$results>. C<$results> is a
466 reference-to-array; its elements are references-to-hash, whose keys
467 are the fields of the aqorderbreakdown table in the Koha database.
471 # FIXME - This function appears in C4::Catalogue.
475 my $query="Select * from aqorderbreakdown where ordernumber='$id'";
476 my $sth=$dbh->prepare($query);
480 while (my $data=$sth->fetchrow_hashref){
486 return($i,\@results);
491 ($count, @orders) = &basket($basketnumber, $booksellerID);
493 Looks up the pending (non-cancelled) orders with the given basket
494 number. If C<$booksellerID> is non-empty, only orders from that seller
497 C<&basket> returns a two-element array. C<@orders> is an array of
498 references-to-hash, whose keys are the fields from the aqorders,
499 biblio, and biblioitems tables in the Koha database. C<$count> is the
500 number of elements in C<@orders>.
504 # FIXME - Almost the same function (with less error-checking) appears in
507 my ($basketno,$supplier)=@_;
509 my $query="Select *,biblio.title from aqorders,biblio,biblioitems
510 where basketno='$basketno'
511 and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber
512 =aqorders.biblioitemnumber
513 and (datecancellationprinted is NULL or datecancellationprinted =
515 if (defined $supplier && $supplier ne ''){
516 $query.=" and aqorders.booksellerid='$supplier'";
518 $query.=" group by aqorders.ordernumber";
519 my $sth=$dbh->prepare($query);
524 while (my $data=$sth->fetchrow_hashref){
535 $basket = &newbasket();
537 Finds the next unused basket number in the aqorders table of the Koha
538 database, and returns it.
542 # FIXME - There's a race condition here:
544 # B calls &newbasket (gets the same number as A)
545 # A updates the basket
546 # B updates the basket, and clobbers A's result.
547 # A better approach might be to create a dummy order (with, say,
548 # requisitionedby == "Dummy-$$" or notes == "dummy <time> <pid>"), and
549 # see which basket number it gets. Then have a cron job periodically
550 # remove out-of-date dummy orders.
551 # FIXME - This function appears in C4::Catalogue.pm
554 my $query="Select max(basketno) from aqorders";
555 my $sth=$dbh->prepare($query);
557 my $data=$sth->fetchrow_arrayref;
558 my $basket=$$data[0];
567 ($count, @results) = &bookfunds();
569 Returns a list of all book funds started on Sep 1, 2001.
571 C<$count> is the number of elements in C<@results>. C<@results> is an
572 array of references-to-hash, whose keys are fields from the aqbookfund
573 and aqbudget tables of the Koha database. Results are ordered
574 alphabetically by book fund name.
578 # FIXME - An identical function (without the hardcoded date) appears in
582 my $query="Select * from aqbookfund,aqbudget where aqbookfund.bookfundid
584 and aqbudget.startdate='2001-07-01'
585 group by aqbookfund.bookfundid order by bookfundname";
586 my $sth=$dbh->prepare($query);
590 while (my $data=$sth->fetchrow_hashref){
601 ($count, @results) = &branches();
603 Returns a list of all library branches.
605 C<$count> is the number of elements in C<@results>. C<@results> is an
606 array of references-to-hash, whose keys are the fields of the branches
607 table of the Koha database.
611 # FIXME - This function (modulo whitespace) appears in C4::Catalogue
614 my $query="Select * from branches";
615 my $sth=$dbh->prepare($query);
620 while (my $data = $sth->fetchrow_hashref){
627 return($i, @results);
630 # FIXME - POD. But I can't figure out what this function is doing
631 # FIXME - An almost identical function appears in C4::Catalogue
632 sub bookfundbreakdown {
635 my $query="Select quantity,datereceived,freight,unitprice,listprice,ecost,quantityreceived,subscription
636 from aqorders,aqorderbreakdown where bookfundid='$id' and
637 aqorders.ordernumber=aqorderbreakdown.ordernumber and ((budgetdate >=
638 '2001-07-01' and budgetdate <'2002-07-01') or
639 (datereceived >= '2001-07-01' and datereceived < '2002-07-01'))
640 and (datecancellationprinted is NULL or
641 datecancellationprinted='0000-00-00')";
642 my $sth=$dbh->prepare($query);
646 while (my $data=$sth->fetchrow_hashref){
647 if ($data->{'subscription'} == 1){
648 $spent+=$data->{'quantity'}*$data->{'unitprice'};
650 my $leftover=$data->{'quantity'}-$data->{'quantityreceived'};
651 $comtd+=($data->{'ecost'})*$leftover;
652 $spent+=($data->{'unitprice'})*$data->{'quantityreceived'};
657 return($spent,$comtd);
663 my $dbh = &C4Connect;
664 my $query = "Select max(biblionumber) from biblio";
665 my $sth = $dbh->prepare($query);
667 my $data = $sth->fetchrow_arrayref;
668 my $bibnum = $$data[0] + 1;
671 $biblio->{'title'} = $dbh->quote($biblio->{'title'});
672 $biblio->{'author'} = $dbh->quote($biblio->{'author'});
673 $biblio->{'copyright'} = $dbh->quote($biblio->{'copyright'});
674 $biblio->{'seriestitle'} = $dbh->quote($biblio->{'seriestitle'});
675 $biblio->{'notes'} = $dbh->quote($biblio->{'notes'});
676 $biblio->{'abstract'} = $dbh->quote($biblio->{'abstract'});
677 if ($biblio->{'seriestitle'}) { $series = 1 };
680 $query = "insert into biblio set
681 biblionumber = $bibnum,
682 title = $biblio->{'title'},
683 author = $biblio->{'author'},
684 copyrightdate = $biblio->{'copyright'},
686 seriestitle = $biblio->{'seriestitle'},
687 notes = $biblio->{'notes'},
688 abstract = $biblio->{'abstract'}";
690 $sth = $dbh->prepare($query);
705 $biblio->{'title'} = $dbh->quote($biblio->{'title'});
706 $biblio->{'author'} = $dbh->quote($biblio->{'author'});
707 $biblio->{'abstract'} = $dbh->quote($biblio->{'abstract'});
708 $biblio->{'copyrightdate'} = $dbh->quote($biblio->{'copyrightdate'});
709 $biblio->{'seriestitle'} = $dbh->quote($biblio->{'serirestitle'});
710 $biblio->{'serial'} = $dbh->quote($biblio->{'serial'});
711 $biblio->{'unititle'} = $dbh->quote($biblio->{'unititle'});
712 $biblio->{'notes'} = $dbh->quote($biblio->{'notes'});
714 $query = "Update biblio set
715 title = $biblio->{'title'},
716 author = $biblio->{'author'},
717 abstract = $biblio->{'abstract'},
718 copyrightdate = $biblio->{'copyrightdate'},
719 seriestitle = $biblio->{'seriestitle'},
720 serial = $biblio->{'serial'},
721 unititle = $biblio->{'unititle'},
722 notes = $biblio->{'notes'}
723 where biblionumber = $biblio->{'biblionumber'}";
724 $sth = $dbh->prepare($query);
730 return($biblio->{'biblionumber'});
735 my ($bibnum, $subtitle) = @_;
737 my $query = "update bibliosubtitle set
738 subtitle = '$subtitle'
739 where biblionumber = $bibnum";
740 my $sth = $dbh->prepare($query);
748 # FIXME - This is functionally identical to &C4::Biblio::modaddauthor
750 my ($bibnum, $author) = @_;
752 my $query = "Delete from additionalauthors where biblionumber = $bibnum";
753 my $sth = $dbh->prepare($query);
759 $query = "Insert into additionalauthors set
761 biblionumber = '$bibnum'";
762 $sth = $dbh->prepare($query);
774 my ($bibnum, $force, @subject) = @_;
776 my $count = @subject;
778 for (my $i = 0; $i < $count; $i++) {
779 $subject[$i] =~ s/^ //g;
780 $subject[$i] =~ s/ $//g;
781 my $query = "select * from catalogueentry
782 where entrytype = 's'
783 and catalogueentry = '$subject[$i]'";
784 my $sth = $dbh->prepare($query);
787 if (my $data = $sth->fetchrow_hashref) {
789 if ($force eq $subject[$i]) {
791 # subject not in aut, chosen to force anway
792 # so insert into cataloguentry so its in auth file
793 $query = "Insert into catalogueentry
794 (entrytype,catalogueentry)
795 values ('s','$subject[$i]')";
796 my $sth2 = $dbh->prepare($query);
803 $error = "$subject[$i]\n does not exist in the subject authority file";
804 $query = "Select * from catalogueentry
805 where entrytype = 's'
806 and (catalogueentry like '$subject[$i] %'
807 or catalogueentry like '% $subject[$i] %'
808 or catalogueentry like '% $subject[$i]')";
809 my $sth2 = $dbh->prepare($query);
812 while (my $data = $sth2->fetchrow_hashref) {
813 $error = $error."<br>$data->{'catalogueentry'}";
822 my $query = "Delete from bibliosubject where biblionumber = $bibnum";
823 my $sth = $dbh->prepare($query);
828 for (my $i = 0; $i < $count; $i++) {
829 $sth = $dbh->prepare("Insert into bibliosubject
830 values ('$subject[$i]', $bibnum)");
843 my ($biblioitem) = @_;
848 # foreach my $field (qw( ... ))
850 # $biblioitem->{$field} = $dbh->quote($biblioitem->{$field});
852 $biblioitem->{'itemtype'} = $dbh->quote($biblioitem->{'itemtype'});
853 $biblioitem->{'url'} = $dbh->quote($biblioitem->{'url'});
854 $biblioitem->{'isbn'} = $dbh->quote($biblioitem->{'isbn'});
855 $biblioitem->{'publishercode'} = $dbh->quote($biblioitem->{'publishercode'});
856 $biblioitem->{'publicationyear'} = $dbh->quote($biblioitem->{'publicationyear'});
857 $biblioitem->{'classification'} = $dbh->quote($biblioitem->{'classification'});
858 $biblioitem->{'dewey'} = $dbh->quote($biblioitem->{'dewey'});
859 $biblioitem->{'subclass'} = $dbh->quote($biblioitem->{'subclass'});
860 $biblioitem->{'illus'} = $dbh->quote($biblioitem->{'illus'});
861 $biblioitem->{'pages'} = $dbh->quote($biblioitem->{'pages'});
862 $biblioitem->{'volumeddesc'} = $dbh->quote($biblioitem->{'volumeddesc'});
863 $biblioitem->{'notes'} = $dbh->quote($biblioitem->{'notes'});
864 $biblioitem->{'size'} = $dbh->quote($biblioitem->{'size'});
865 $biblioitem->{'place'} = $dbh->quote($biblioitem->{'place'});
867 $query = "Update biblioitems set
868 itemtype = $biblioitem->{'itemtype'},
869 url = $biblioitem->{'url'},
870 isbn = $biblioitem->{'isbn'},
871 publishercode = $biblioitem->{'publishercode'},
872 publicationyear = $biblioitem->{'publicationyear'},
873 classification = $biblioitem->{'classification'},
874 dewey = $biblioitem->{'dewey'},
875 subclass = $biblioitem->{'subclass'},
876 illus = $biblioitem->{'illus'},
877 pages = $biblioitem->{'pages'},
878 volumeddesc = $biblioitem->{'volumeddesc'},
879 notes = $biblioitem->{'notes'},
880 size = $biblioitem->{'size'},
881 place = $biblioitem->{'place'}
882 where biblioitemnumber = $biblioitem->{'biblioitemnumber'}";
891 my ($bibitemnum,$note)=@_;
893 my $query="update biblioitems set notes='$note' where
894 biblioitemnumber='$bibitemnum'";
895 my $sth=$dbh->prepare($query);
902 # FIXME - &C4::Biblio::newbiblioitem is quite similar to this
904 my ($biblioitem) = @_;
906 my $query = "Select max(biblioitemnumber) from biblioitems";
907 my $sth = $dbh->prepare($query);
911 $biblioitem->{'volume'} = $dbh->quote($biblioitem->{'volume'});
912 $biblioitem->{'number'} = $dbh->quote($biblioitem->{'number'});
913 $biblioitem->{'classification'} = $dbh->quote($biblioitem->{'classification'});
914 $biblioitem->{'itemtype'} = $dbh->quote($biblioitem->{'itemtype'});
915 $biblioitem->{'url'} = $dbh->quote($biblioitem->{'url'});
916 $biblioitem->{'isbn'} = $dbh->quote($biblioitem->{'isbn'});
917 $biblioitem->{'issn'} = $dbh->quote($biblioitem->{'issn'});
918 $biblioitem->{'dewey'} = $dbh->quote($biblioitem->{'dewey'});
919 $biblioitem->{'subclass'} = $dbh->quote($biblioitem->{'subclass'});
920 $biblioitem->{'publicationyear'} = $dbh->quote($biblioitem->{'publicationyear'});
921 $biblioitem->{'publishercode'} = $dbh->quote($biblioitem->{'publishercode'});
922 $biblioitem->{'volumedate'} = $dbh->quote($biblioitem->{'volumedate'});
923 $biblioitem->{'volumeddesc'} = $dbh->quote($biblioitem->{'volumeddesc'}); $biblioitem->{'illus'} = $dbh->quote($biblioitem->{'illus'});
924 $biblioitem->{'illus'} = $dbh->quote($biblioitem->{'illus'});
925 $biblioitem->{'pages'} = $dbh->quote($biblioitem->{'pages'});
926 $biblioitem->{'notes'} = $dbh->quote($biblioitem->{'notes'});
927 $biblioitem->{'size'} = $dbh->quote($biblioitem->{'size'});
928 $biblioitem->{'place'} = $dbh->quote($biblioitem->{'place'});
929 $biblioitem->{'lccn'} = $dbh->quote($biblioitem->{'lccn'});
930 $biblioitem->{'marc'} = $dbh->quote($biblioitem->{'marc'});
933 $data = $sth->fetchrow_arrayref;
934 $bibitemnum = $$data[0] + 1;
938 $query = "insert into biblioitems set
939 biblioitemnumber = $bibitemnum,
940 biblionumber = $biblioitem->{'biblionumber'},
941 volume = $biblioitem->{'volume'},
942 number = $biblioitem->{'number'},
943 classification = $biblioitem->{'classification'},
944 itemtype = $biblioitem->{'itemtype'},
945 url = $biblioitem->{'url'},
946 isbn = $biblioitem->{'isbn'},
947 issn = $biblioitem->{'issn'},
948 dewey = $biblioitem->{'dewey'},
949 subclass = $biblioitem->{'subclass'},
950 publicationyear = $biblioitem->{'publicationyear'},
951 publishercode = $biblioitem->{'publishercode'},
952 volumedate = $biblioitem->{'volumedate'},
953 volumeddesc = $biblioitem->{'volumeddesc'},
954 illus = $biblioitem->{'illus'},
955 pages = $biblioitem->{'pages'},
956 notes = $biblioitem->{'notes'},
957 size = $biblioitem->{'size'},
958 lccn = $biblioitem->{'lccn'},
959 marc = $biblioitem->{'marc'},
960 place = $biblioitem->{'place'}";
962 $sth = $dbh->prepare($query);
974 my $query="insert into bibliosubject (biblionumber) values
976 my $sth=$dbh->prepare($query);
984 # FIXME - This is in effect the same as &C4::Biblio::newsubtitle
986 my ($bibnum, $subtitle) = @_;
988 $subtitle = $dbh->quote($subtitle);
989 my $query = "insert into bibliosubtitle set
990 biblionumber = $bibnum,
991 subtitle = $subtitle";
992 my $sth = $dbh->prepare($query);
1002 &neworder($biblionumber, $title, $ordnum, $basket, $quantity, $listprice,
1003 $booksellerid, $who, $notes, $bookfund, $biblioitemnumber, $rrp,
1004 $ecost, $gst, $budget, $unitprice, $subscription,
1005 $booksellerinvoicenumber);
1007 Adds a new order to the database. Any argument that isn't described
1008 below is the new value of the field with the same name in the aqorders
1009 table of the Koha database.
1011 C<$ordnum> is a "minimum order number." After adding the new entry to
1012 the aqorders table, C<&neworder> finds the first entry in aqorders
1013 with order number greater than or equal to C<$ordnum>, and adds an
1014 entry to the aqorderbreakdown table, with the order number just found,
1015 and the book fund ID of the newly-added order.
1017 C<$budget> is effectively ignored.
1019 C<$subscription> may be either "yes", or anything else for "no".
1023 # FIXME - This function appears in C4::Catalogue
1025 my ($bibnum,$title,$ordnum,$basket,$quantity,$listprice,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$sub,$invoice)=@_;
1026 if ($budget eq 'now'){
1029 $budget="'2001-07-01'";
1037 my $query="insert into aqorders (biblionumber,title,basketno,
1038 quantity,listprice,booksellerid,entrydate,requisitionedby,authorisedby,notes,
1039 biblioitemnumber,rrp,ecost,gst,unitprice,subscription,booksellerinvoicenumber)
1042 ($bibnum,'$title',$basket,$quantity,$listprice,'$supplier',now(),
1043 '$who','$who','$notes',$bibitemnum,'$rrp','$ecost','$gst','$cost',
1044 '$sub','$invoice')";
1045 my $sth=$dbh->prepare($query);
1049 $query="select * from aqorders where
1050 biblionumber=$bibnum and basketno=$basket and ordernumber >=$ordnum";
1051 $sth=$dbh->prepare($query);
1053 my $data=$sth->fetchrow_hashref;
1055 $ordnum=$data->{'ordernumber'};
1056 $query="insert into aqorderbreakdown (ordernumber,bookfundid) values
1057 ($ordnum,'$bookfund')";
1058 $sth=$dbh->prepare($query);
1067 &delorder($biblionumber, $ordernumber);
1069 Cancel the order with the given order and biblio numbers. It does not
1070 delete any entries in the aqorders table, it merely marks them as
1073 If there are no items remaining with the given biblionumber,
1074 C<&delorder> also deletes them from the marc_subfield_table and
1075 marc_biblio tables of the Koha database.
1079 # FIXME - This function appears in C4::Catalogue
1081 my ($bibnum,$ordnum)=@_;
1083 my $query="update aqorders set datecancellationprinted=now()
1084 where biblionumber='$bibnum' and
1085 ordernumber='$ordnum'";
1086 my $sth=$dbh->prepare($query);
1090 my $count=itemcount($bibnum);
1099 &modorder($title, $ordernumber, $quantity, $listprice,
1100 $biblionumber, $basketno, $supplier, $who, $notes,
1101 $bookfundid, $bibitemnum, $rrp, $ecost, $gst, $budget,
1102 $unitprice, $booksellerinvoicenumber);
1104 Modifies an existing order. Updates the order with order number
1105 C<$ordernumber> and biblionumber C<$biblionumber>. All other arguments
1106 update the fields with the same name in the aqorders table of the Koha
1109 Entries with order number C<$ordernumber> in the aqorderbreakdown
1110 table are also updated to the new book fund ID.
1114 # FIXME - This function appears in C4::Catalogue
1116 my ($title,$ordnum,$quantity,$listprice,$bibnum,$basketno,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$invoice)=@_;
1118 my $query="update aqorders set title='$title',
1119 quantity='$quantity',listprice='$listprice',basketno='$basketno',
1120 rrp='$rrp',ecost='$ecost',unitprice='$cost',
1121 booksellerinvoicenumber='$invoice'
1123 ordernumber=$ordnum and biblionumber=$bibnum";
1124 my $sth=$dbh->prepare($query);
1128 $query="update aqorderbreakdown set bookfundid=$bookfund where
1129 ordernumber=$ordnum";
1130 $sth=$dbh->prepare($query);
1139 $order = &newordernum();
1141 Finds the next unused order number in the aqorders table of the Koha
1142 database, and returns it.
1146 # FIXME - Race condition
1147 # FIXME - This function appears in C4::Catalogue
1150 my $query="Select max(ordernumber) from aqorders";
1151 my $sth=$dbh->prepare($query);
1153 my $data=$sth->fetchrow_arrayref;
1154 my $ordnum=$$data[0];
1163 &receiveorder($biblionumber, $ordernumber, $quantityreceived, $user,
1164 $unitprice, $booksellerinvoicenumber, $biblioitemnumber,
1165 $freight, $bookfund, $rrp);
1167 Updates an order, to reflect the fact that it was received, at least
1168 in part. All arguments not mentioned below update the fields with the
1169 same name in the aqorders table of the Koha database.
1171 Updates the order with bibilionumber C<$biblionumber> and ordernumber
1174 Also updates the book fund ID in the aqorderbreakdown table.
1178 # FIXME - This function appears in C4::Catalogue
1180 my ($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno,$freight,$bookfund,$rrp)=@_;
1182 my $query="update aqorders set quantityreceived='$quantrec',
1183 datereceived=now(),booksellerinvoicenumber='$invoiceno',
1184 biblioitemnumber=$bibitemno,unitprice='$cost',freight='$freight',
1186 where biblionumber=$biblio and ordernumber=$ordnum
1189 my $sth=$dbh->prepare($query);
1192 $query="update aqorderbreakdown set bookfundid=$bookfund where
1193 ordernumber=$ordnum";
1194 $sth=$dbh->prepare($query);
1201 =item updaterecorder
1203 &updaterecorder($biblionumber, $ordernumber, $user, $unitprice,
1206 Updates the order with biblionumber C<$biblionumber> and order number
1207 C<$ordernumber>. C<$bookfundid> is the new value for the book fund ID
1208 in the aqorderbreakdown table of the Koha database. All other
1209 arguments update the fields with the same name in the aqorders table.
1211 C<$user> is ignored.
1215 # FIXME - This function appears in C4::Catalogue
1217 my($biblio,$ordnum,$user,$cost,$bookfund,$rrp)=@_;
1219 my $query="update aqorders set
1220 unitprice='$cost', rrp='$rrp'
1221 where biblionumber=$biblio and ordernumber=$ordnum
1224 my $sth=$dbh->prepare($query);
1227 $query="update aqorderbreakdown set bookfundid=$bookfund where
1228 ordernumber=$ordnum";
1229 $sth=$dbh->prepare($query);
1238 $foreignprice = &curconvert($currency, $localprice);
1240 Converts the price C<$localprice> to foreign currency C<$currency> by
1241 dividing by the exchange rate, and returns the result.
1243 If no exchange rate is found, C<&curconvert> assumes the rate is one
1248 # FIXME - An almost identical version of this function appears in
1251 my ($currency,$price)=@_;
1253 my $query="Select rate from currency where currency='$currency'";
1254 my $sth=$dbh->prepare($query);
1256 my $data=$sth->fetchrow_hashref;
1259 my $cur=$data->{'rate'};
1263 $price=$price / $cur;
1269 ($count, $currencies) = &getcurrencies();
1271 Returns the list of all known currencies.
1273 C<$count> is the number of elements in C<$currencies>. C<$currencies>
1274 is a reference-to-array; its elements are references-to-hash, whose
1275 keys are the fields from the currency table in the Koha database.
1279 # FIXME - This function appears in C4::Catalogue
1282 my $query="Select * from currency";
1283 my $sth=$dbh->prepare($query);
1287 while (my $data=$sth->fetchrow_hashref){
1293 return($i,\@results);
1296 # FIXME - This function appears in C4::Catalogue. Neither one is used.
1300 my $query="Select * from currency where currency='$cur'";
1301 my $sth=$dbh->prepare($query);
1304 my $data=$sth->fetchrow_hashref;
1310 =item updatecurrencies
1312 &updatecurrencies($currency, $newrate);
1314 Sets the exchange rate for C<$currency> to be C<$newrate>.
1318 # FIXME - This function appears in C4::Catalogue
1319 sub updatecurrencies {
1320 my ($currency,$rate)=@_;
1322 my $query="update currency set rate=$rate where currency='$currency'";
1323 my $sth=$dbh->prepare($query);
1331 &updatesup($bookseller);
1333 Updates the information for a given bookseller. C<$bookseller> is a
1334 reference-to-hash whose keys are the fields of the aqbooksellers table
1335 in the Koha database. It must contain entries for all of the fields.
1336 The entry to modify is determined by C<$bookseller-E<gt>{id}>.
1338 The easiest way to get all of the necessary fields is to look up a
1339 book seller with C<&booksellers>, modify what's necessary, then call
1340 C<&updatesup> with the result.
1344 # FIXME - This function appears in C4::Catalogue
1348 my $query="Update aqbooksellers set
1349 name='$data->{'name'}',address1='$data->{'address1'}',address2='$data->{'address2'}',
1350 address3='$data->{'address3'}',address4='$data->{'address4'}',postal='$data->{'postal'}',
1351 phone='$data->{'phone'}',fax='$data->{'fax'}',url='$data->{'url'}',
1352 contact='$data->{'contact'}',contpos='$data->{'contpos'}',
1353 contphone='$data->{'contphone'}', contfax='$data->{'contfax'}', contaltphone=
1354 '$data->{'contaltphone'}', contemail='$data->{'contemail'}', contnotes=
1355 '$data->{'contnotes'}', active=$data->{'active'},
1356 listprice='$data->{'listprice'}', invoiceprice='$data->{'invoiceprice'}',
1357 gstreg=$data->{'gstreg'}, listincgst=$data->{'listincgst'},
1358 invoiceincgst=$data->{'invoiceincgst'}, specialty='$data->{'specialty'}',
1359 discount='$data->{'discount'}',invoicedisc='$data->{'invoicedisc'}',
1360 nocalc='$data->{'nocalc'}'
1361 where id='$data->{'id'}'";
1362 my $sth=$dbh->prepare($query);
1373 my $sth=$dbh->prepare("Select max(id) from aqbooksellers");
1375 my $data2=$sth->fetchrow_hashref;
1377 $data2->{'max(id)'}++;
1378 $sth=$dbh->prepare("Insert into aqbooksellers (id) values ($data2->{'max(id)'})");
1381 $data->{'id'}=$data2->{'max(id)'};
1384 return($data->{'id'});
1389 $id = &insertsup($bookseller);
1391 Creates a new bookseller. C<$bookseller> is a reference-to-hash whose
1392 keys are the fields of the aqbooksellers table in the Koha database.
1393 All fields must be present.
1395 Returns the ID of the newly-created bookseller.
1399 # FIXME - This function appears in C4::Catalogue
1401 my ($item, @barcodes) = @_;
1402 my $dbh = C4Connect;
1403 my $query = "Select max(itemnumber) from items";
1404 my $sth = $dbh->prepare($query);
1410 $data = $sth->fetchrow_hashref;
1411 $itemnumber = $data->{'max(itemnumber)'} + 1;
1414 $item->{'booksellerid'} = $dbh->quote($item->{'booksellerid'});
1415 $item->{'homebranch'} = $dbh->quote($item->{'homebranch'});
1416 $item->{'price'} = $dbh->quote($item->{'price'});
1417 $item->{'replacementprice'} = $dbh->quote($item->{'replacementprice'});
1418 $item->{'itemnotes'} = $dbh->quote($item->{'itemnotes'});
1420 foreach my $barcode (@barcodes) {
1421 $barcode = uc($barcode);
1422 $barcode = $dbh->quote($barcode);
1423 $query = "Insert into items set
1424 itemnumber = $itemnumber,
1425 biblionumber = $item->{'biblionumber'},
1426 biblioitemnumber = $item->{'biblioitemnumber'},
1428 booksellerid = $item->{'booksellerid'},
1429 dateaccessioned = NOW(),
1430 homebranch = $item->{'homebranch'},
1431 holdingbranch = $item->{'homebranch'},
1432 price = $item->{'price'},
1433 replacementprice = $item->{'replacementprice'},
1434 replacementpricedate = NOW(),
1435 itemnotes = $item->{'itemnotes'}";
1437 if ($item->{'loan'}) {
1439 notforloan = $item->{'loan'}";
1442 $sth = $dbh->prepare($query);
1445 $error .= $sth->errstr;
1457 my ($count,@barcodes)=@_;
1460 for (my $i=0;$i<$count;$i++){
1461 $barcodes[$i]=uc $barcodes[$i];
1462 my $query="Select * from items where barcode='$barcodes[$i]'";
1463 my $sth=$dbh->prepare($query);
1465 if (my $data=$sth->fetchrow_hashref){
1466 $error.=" Duplicate Barcode: $barcodes[$i]";
1476 my ($loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
1478 my $query="update items set biblioitemnumber=$bibitemnum,
1479 barcode='$barcode',itemnotes='$notes'
1480 where itemnumber=$itemnum";
1481 if ($barcode eq ''){
1482 $query="update items set biblioitemnumber=$bibitemnum,notforloan=$loan where itemnumber=$itemnum";
1485 $query="update items set biblioitemnumber=$bibitemnum,
1486 barcode='$barcode',itemnotes='$notes',homebranch='$homebranch',
1487 itemlost='$lost',wthdrawn='$wthdrawn' where itemnumber=$itemnum";
1489 if ($replacement ne ''){
1490 $query=~ s/ where/,replacementprice='$replacement' where/;
1493 my $sth=$dbh->prepare($query);
1499 # FIXME - This function appears in C4::Catalogue. Neither one is used
1501 my($price,$rrp,$itemnum)=@_;
1503 my $query="update items set price='$price',replacementprice='$rrp'
1504 where itemnumber=$itemnum";
1505 my $sth=$dbh->prepare($query);
1513 my ($bibitemnum)=@_;
1515 my $query="Select count(*) from items where biblioitemnumber='$bibitemnum'";
1516 my $sth=$dbh->prepare($query);
1518 my $data=$sth->fetchrow_hashref;
1521 return($data->{'count(*)'});
1524 # FIXME - This function appears in C4::Catalogue. Neither one is used.
1526 my ($biblionumber)=@_;
1528 my $query="Select * from biblioitems,items,itemtypes where
1529 biblioitems.biblionumber=$biblionumber
1530 and biblioitems.biblioitemnumber=items.biblioitemnumber and
1531 itemtypes.itemtype=biblioitems.itemtype
1532 order by items.biblioitemnumber";
1533 my $sth=$dbh->prepare($query);
1537 while (my $data=$sth->fetchrow_hashref){
1546 # FIXME - This function appears in C4::Catalogue. Neither one is used
1548 my ($bibitemnum,$itemtype)=@_;
1550 my $query="Select * from biblioitems where biblioitemnumber=$bibitemnum
1551 and itemtype='$itemtype'";
1552 my $sth=$dbh->prepare($query);
1555 if (my $data=$sth->fetchrow_hashref){
1563 # FIXME - A nearly-identical function, appears in C4::Biblio
1568 my $query="select * from items where itemnumber=$itemnum";
1569 my $sth=$dbh->prepare($query);
1571 my @data=$sth->fetchrow_array;
1573 $query="Insert into deleteditems values (";
1574 foreach my $temp (@data){
1575 $query=$query."'$temp',";
1579 $sth=$dbh->prepare($query);
1582 $query = "Delete from items where itemnumber=$itemnum";
1583 $sth=$dbh->prepare($query);
1590 sub deletebiblioitem {
1591 my ($biblioitemnumber) = @_;
1592 my $dbh = C4Connect;
1593 my $query = "Select * from biblioitems
1594 where biblioitemnumber = $biblioitemnumber";
1595 my $sth = $dbh->prepare($query);
1600 if (@results = $sth->fetchrow_array) {
1602 $query = "Insert into deletedbiblioitems values (";
1603 foreach my $value (@results) {
1604 $value = $dbh->quote($value);
1605 $query .= "$value,";
1608 $query =~ s/\,$/\)/;
1611 $query = "Delete from biblioitems
1612 where biblioitemnumber = $biblioitemnumber";
1618 # Now delete all the items attached to the biblioitem
1620 $query = "Select * from items where biblioitemnumber = $biblioitemnumber";
1621 $sth = $dbh->prepare($query);
1625 while (@results = $sth->fetchrow_array) {
1627 $query = "Insert into deleteditems values (";
1628 foreach my $value (@results) {
1629 $value = $dbh->quote($value);
1630 $query .= "$value,";
1633 $query =~ s/\,$/\)/;
1639 $query = "Delete from items where biblioitemnumber = $biblioitemnumber";
1643 } # sub deletebiblioitem
1649 my $query="select * from biblio where biblionumber=$biblio";
1650 my $sth=$dbh->prepare($query);
1652 if (my @data=$sth->fetchrow_array){
1654 $query="Insert into deletedbiblio values (";
1655 foreach my $temp (@data){
1656 $temp=~ s/\'/\\\'/g;
1657 $query=$query."'$temp',";
1661 $sth=$dbh->prepare($query);
1664 $query = "Delete from biblio where biblionumber=$biblio";
1665 $sth=$dbh->prepare($query);
1676 my $dbh = C4Connect;
1677 my $query = "select * from itemtypes";
1678 my $sth = $dbh->prepare($query);
1679 # || die "Cannot prepare $query" . $dbh->errstr;
1684 # || die "Cannot execute $query\n" . $sth->errstr;
1685 while (my $data = $sth->fetchrow_hashref) {
1686 $results[$count] = $data;
1692 return($count, @results);
1693 } # sub getitemtypes
1697 my ($biblionumber) = @_;
1698 my $dbh = C4Connect;
1699 my $query = "Select * from biblio where biblionumber = $biblionumber";
1700 my $sth = $dbh->prepare($query);
1701 # || die "Cannot prepare $query\n" . $dbh->errstr;
1706 # || die "Cannot execute $query\n" . $sth->errstr;
1707 while (my $data = $sth->fetchrow_hashref) {
1708 $results[$count] = $data;
1714 return($count, @results);
1719 my ($biblioitemnum) = @_;
1720 my $dbh = C4Connect;
1721 my $query = "Select * from biblioitems where
1722 biblioitemnumber = $biblioitemnum";
1723 my $sth = $dbh->prepare($query);
1729 while (my $data = $sth->fetchrow_hashref) {
1730 $results[$count] = $data;
1736 return($count, @results);
1737 } # sub getbiblioitem
1740 sub getbiblioitembybiblionumber {
1741 my ($biblionumber) = @_;
1742 my $dbh = C4Connect;
1743 my $query = "Select * from biblioitems where biblionumber =
1745 my $sth = $dbh->prepare($query);
1751 while (my $data = $sth->fetchrow_hashref) {
1752 $results[$count] = $data;
1758 return($count, @results);
1762 sub getitemsbybiblioitem {
1763 my ($biblioitemnum) = @_;
1764 my $dbh = C4Connect;
1765 my $query = "Select * from items, biblio where
1766 biblio.biblionumber = items.biblionumber and biblioitemnumber
1768 my $sth = $dbh->prepare($query);
1769 # || die "Cannot prepare $query\n" . $dbh->errstr;
1774 # || die "Cannot execute $query\n" . $sth->errstr;
1775 while (my $data = $sth->fetchrow_hashref) {
1776 $results[$count] = $data;
1782 return($count, @results);
1783 } # sub getitemsbybiblioitem
1788 my $dbh = C4Connect;
1794 $isbn = $dbh->quote($isbn);
1795 $query = "Select biblio.* from biblio, biblioitems where
1796 biblio.biblionumber = biblioitems.biblionumber
1798 $sth = $dbh->prepare($query);
1801 while (my $data = $sth->fetchrow_hashref) {
1802 $results[$count] = $data;
1808 return($count, @results);
1813 ($count, @results) = &websitesearch($keywordlist);
1815 Looks up biblioitems by URL.
1817 C<$keywordlist> is a space-separated list of search terms.
1818 C<&websitesearch> returns those biblioitems whose URL contains at
1819 least one of the search terms.
1821 C<$count> is the number of elements in C<@results>. C<@results> is an
1822 array of references-to-hash, whose keys are the fields of the biblio
1823 and biblioitems tables in the Koha database.
1827 # FIXME - This function appears in C4::Catalogue
1829 my ($keywordlist) = @_;
1830 my $dbh = C4Connect;
1831 my $query = "Select distinct biblio.* from biblio, biblioitems where
1832 biblio.biblionumber = biblioitems.biblionumber and (";
1836 my @keywords = split(/ +/, $keywordlist);
1837 my $keyword = shift(@keywords);
1839 $keyword =~ s/%/\\%/g;
1840 $keyword =~ s/_/\\_/;
1841 $keyword = "%" . $keyword . "%";
1842 $keyword = $dbh->quote($keyword);
1843 $query .= " (url like $keyword)";
1845 foreach $keyword (@keywords) {
1846 $keyword =~ s/%/\\%/;
1847 $keyword =~ s/_/\\_/;
1848 $keyword = "%" . $keyword . "%";
1849 $keyword = $dbh->quote($keyword);
1850 $query .= " or (url like $keyword)";
1854 $sth = $dbh->prepare($query);
1857 while (my $data = $sth->fetchrow_hashref) {
1858 $results[$count] = $data;
1864 return($count, @results);
1865 } # sub websitesearch
1869 &addwebsite($website);
1871 Adds a new web site. C<$website> is a reference-to-hash, with the keys
1872 C<biblionumber>, C<title>, C<description>, and C<url>. All of these
1877 # FIXME - This function appears in C4::Catalogue
1880 my $dbh = C4Connect;
1883 $website->{'biblionumber'} = $dbh->quote($website->{'biblionumber'});
1884 $website->{'title'} = $dbh->quote($website->{'title'});
1885 $website->{'description'} = $dbh->quote($website->{'description'});
1886 $website->{'url'} = $dbh->quote($website->{'url'});
1888 $query = "Insert into websites set
1889 biblionumber = $website->{'biblionumber'},
1890 title = $website->{'title'},
1891 description = $website->{'description'},
1892 url = $website->{'url'}";
1901 &updatewebsite($website);
1903 Updates an existing web site. C<$website> is a reference-to-hash with
1904 the keys C<websitenumber>, C<title>, C<description>, and C<url>. All
1905 of these are mandatory. C<$website-E<gt>{websitenumber}> identifies
1906 the entry to update.
1910 # FIXME - This function appears in C4::Catalogue
1913 my $dbh = C4Connect;
1916 $website->{'title'} = $dbh->quote($website->{'title'});
1917 $website->{'description'} = $dbh->quote($website->{'description'});
1918 $website->{'url'} = $dbh->quote($website->{'url'});
1920 $query = "Update websites set
1921 title = $website->{'title'},
1922 description = $website->{'description'},
1923 url = $website->{'url'}
1924 where websitenumber = $website->{'websitenumber'}";
1929 } # sub updatewebsite
1933 &deletewebsite($websitenumber);
1935 Deletes the web site with number C<$websitenumber>.
1939 # FIXME - This function appears in C4::Catalogue
1941 my ($websitenumber) = @_;
1942 my $dbh = C4Connect;
1943 my $query = "Delete from websites where websitenumber = $websitenumber";
1948 } # sub deletewebsite
1951 END { } # module clean-up code here (global destructor)
1960 Koha Developement team <info@koha.org>