1 package C4::Acquisitions; #assumes C4/Acquisitions.pm
7 use vars qw($VERSION @ISA @EXPORT);
9 # set the version for version checking
13 @EXPORT = qw(&getorders &bookseller &breakdown &basket &newbasket &bookfunds
14 &ordersearch &newbiblio &newbiblioitem &newsubject &newsubtitle &neworder
15 &newordernum &modbiblio &modorder &getsingleorder &invoice &receiveorder
16 &bookfundbreakdown &curconvert &updatesup &insertsup &makeitems &modbibitem
17 &getcurrencies &modsubtitle &modsubject &modaddauthor &moditem &countitems
18 &findall &needsmod &delitem &delbibitem &delbiblio &delorder &branches
19 &getallorders &getrecorders &updatecurrencies &getorder &getcurrency &updaterecorder
20 &updatecost &checkitems &modnote &getitemtypes &getbiblio);
25 my $query = "Select count(*),authorisedby,entrydate,basketno from aqorders where
26 booksellerid='$supplierid' and (quantity > quantityreceived or
27 quantityreceived is NULL)
28 and (datecancellationprinted is NULL or datecancellationprinted = '0000-00-00')";
29 $query.=" group by basketno order by entrydate desc";
31 my $sth=$dbh->prepare($query);
35 while (my $data=$sth->fetchrow_hashref){
41 return ($i,\@results);
47 my $query="Select count(*) from items where biblionumber=$biblio";
49 my $sth=$dbh->prepare($query);
51 my $data=$sth->fetchrow_hashref;
54 return($data->{'count(*)'});
60 my $query="Select ordernumber
62 where biblionumber=? and biblioitemnumber=?";
63 my $sth=$dbh->prepare($query);
64 $sth->execute($bib,$bi);
65 my $ordnum=$sth->fetchrow_hashref;
67 my $order=getsingleorder($ordnum->{'ordernumber'});
70 return ($order,$ordnum->{'ordernumber'});
76 my $query="Select * from biblio,biblioitems,aqorders,aqorderbreakdown
77 where aqorders.ordernumber=?
78 and biblio.biblionumber=aqorders.biblionumber and
79 biblioitems.biblioitemnumber=aqorders.biblioitemnumber and
80 aqorders.ordernumber=aqorderbreakdown.ordernumber";
81 my $sth=$dbh->prepare($query);
82 $sth->execute($ordnum);
83 my $data=$sth->fetchrow_hashref;
92 my $query="Select * from aqorders,biblio,biblioitems where
93 booksellerinvoicenumber='$invoice'
94 and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=
95 aqorders.biblioitemnumber group by aqorders.ordernumber,aqorders.biblioitemnumber";
98 my $sth=$dbh->prepare($query);
100 while (my $data=$sth->fetchrow_hashref){
110 #gets all orders from a certain supplier, orders them alphabetically
113 my $query="Select * from aqorders,biblio,biblioitems where booksellerid='$supid'
114 and (cancelledby is NULL or cancelledby = '')
115 and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=
116 aqorders.biblioitemnumber
117 group by aqorders.biblioitemnumber
122 my $sth=$dbh->prepare($query);
124 while (my $data=$sth->fetchrow_hashref){
134 #gets all orders from a certain supplier, orders them alphabetically
137 my $query="Select * from aqorders,biblio,biblioitems where booksellerid='$supid'
138 and (cancelledby is NULL or cancelledby = '')
139 and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber=
140 aqorders.biblioitemnumber and
141 aqorders.quantityreceived>0
142 and aqorders.datereceived >=now()
143 group by aqorders.biblioitemnumber
148 my $sth=$dbh->prepare($query);
150 while (my $data=$sth->fetchrow_hashref){
160 my ($search,$biblio,$catview)=@_;
162 my $query="Select *,biblio.title from aqorders,biblioitems,biblio
163 where aqorders.biblioitemnumber=
164 biblioitems.biblioitemnumber and biblio.biblionumber=aqorders.biblionumber
165 and (datecancellationprinted is NULL or datecancellationprinted =
168 my @data=split(' ',$search);
170 for (my $i=0;$i<$count;$i++){
171 $query.= "(biblio.title like '$data[$i]%' or biblio.title like '% $data[$i]%') and ";
174 $query.=" ) or biblioitems.isbn='$search'
175 or (aqorders.ordernumber='$search' and aqorders.biblionumber='$biblio')) ";
176 if ($catview ne 'yes'){
177 $query.=" and (quantityreceived < quantity or quantityreceived is NULL)";
179 $query.=" group by aqorders.ordernumber";
180 my $sth=$dbh->prepare($query);
185 while (my $data=$sth->fetchrow_hashref){
186 my $sth2=$dbh->prepare("Select * from biblio where
187 biblionumber='$data->{'biblionumber'}'");
189 my $data2=$sth2->fetchrow_hashref;
191 $data->{'author'}=$data2->{'author'};
192 $data->{'seriestitle'}=$data2->{'seriestitle'};
193 $sth2=$dbh->prepare("Select * from aqorderbreakdown where
194 ordernumber=$data->{'ordernumber'}");
196 $data2=$sth2->fetchrow_hashref;
198 $data->{'branchcode'}=$data2->{'branchcode'};
199 $data->{'bookfundid'}=$data2->{'bookfundid'};
210 my ($searchstring)=@_;
212 my $query="Select * from aqbooksellers where name like '%$searchstring%' or
213 id = '$searchstring'";
214 my $sth=$dbh->prepare($query);
218 while (my $data=$sth->fetchrow_hashref){
230 my $query="Select * from aqorderbreakdown where ordernumber='$id'";
231 my $sth=$dbh->prepare($query);
235 while (my $data=$sth->fetchrow_hashref){
241 return($i,\@results);
245 my ($basketno,$supplier)=@_;
247 my $query="Select *,biblio.title from aqorders,biblio,biblioitems
248 where basketno='$basketno'
249 and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber
250 =aqorders.biblioitemnumber
251 and (datecancellationprinted is NULL or datecancellationprinted =
253 if ($supplier ne ''){
254 $query.=" and aqorders.booksellerid='$supplier'";
256 $query.=" group by aqorders.ordernumber";
257 my $sth=$dbh->prepare($query);
262 while (my $data=$sth->fetchrow_hashref){
273 my $query="Select max(basketno) from aqorders";
274 my $sth=$dbh->prepare($query);
276 my $data=$sth->fetchrow_arrayref;
277 my $basket=$$data[0];
286 my $query="Select * from aqbookfund,aqbudget where aqbookfund.bookfundid
288 and aqbudget.startdate='2001=07-01'
289 group by aqbookfund.bookfundid order by bookfundname";
290 my $sth=$dbh->prepare($query);
294 while (my $data=$sth->fetchrow_hashref){
305 my $query="Select * from branches";
306 my $sth=$dbh->prepare($query);
310 while (my $data=$sth->fetchrow_hashref){
319 sub bookfundbreakdown {
322 my $query="Select quantity,datereceived,freight,unitprice,listprice,ecost,quantityreceived,subscription
323 from aqorders,aqorderbreakdown where bookfundid='$id' and
324 aqorders.ordernumber=aqorderbreakdown.ordernumber and ((budgetdate >=
325 '2001-07-01' and budgetdate <'2002-07-01') or
326 (datereceived >= '2001-07-01' and datereceived < '2002-07-01'))
327 and (datecancellationprinted is NULL or
328 datecancellationprinted='0000-00-00')";
329 my $sth=$dbh->prepare($query);
333 while (my $data=$sth->fetchrow_hashref){
334 if ($data->{'subscription'} == 1){
335 $spent+=$data->{'quantity'}*$data->{'unitprice'};
337 my $leftover=$data->{'quantity'}-$data->{'quantityreceived'};
338 $comtd+=($data->{'ecost'})*$leftover;
339 $spent+=($data->{'unitprice'})*$data->{'quantityreceived'};
344 return($spent,$comtd);
350 my $dbh = &C4Connect;
351 my $query = "Select max(biblionumber) from biblio";
352 my $sth = $dbh->prepare($query);
354 my $data = $sth->fetchrow_arrayref;
355 my $bibnum = $$data[0] + 1;
358 if ($biblio->{'seriestitle'}) { $series = 1 } else { $series = 0 };
361 $query = "insert into biblio set
371 $sth = $dbh->prepare($query);
376 $biblio->{'copyright'},
378 $biblio->{'seriestitle'} ,
388 my ($bibnum,$title,$author,$copyright,$seriestitle,$serial,$unititle,$notes)=@_;
390 my $query="update biblio set title='$title',
391 author='$author',copyrightdate='$copyright',
392 seriestitle='$seriestitle',serial='$serial',unititle='$unititle',notes='$notes'
394 biblionumber=$bibnum";
395 my $sth=$dbh->prepare($query);
403 my ($bibnum,$subtitle)=@_;
405 my $query="update bibliosubtitle set subtitle='$subtitle' where biblionumber=$bibnum";
406 my $sth=$dbh->prepare($query);
413 my ($bibnum,$author)=@_;
415 my $query="Delete from additionalauthors where biblionumber=$bibnum";
416 my $sth=$dbh->prepare($query);
420 $query="insert into additionalauthors (author,biblionumber) values ('$author','$bibnum')";
421 $sth=$dbh->prepare($query);
429 my ($bibnum,$force,@subject)=@_;
433 for (my $i=0;$i<$count;$i++){
434 $subject[$i]=~ s/^ //g;
435 $subject[$i]=~ s/ $//g;
436 my $query="select * from catalogueentry where entrytype='s' and
437 catalogueentry='$subject[$i]'";
438 my $sth=$dbh->prepare($query);
440 if (my $data=$sth->fetchrow_hashref){
443 if ($force eq $subject[$i]){
444 #subject not in aut, chosen to force anway
445 #so insert into cataloguentry so its in auth file
446 $query="Insert into catalogueentry (entrytype,catalogueentry)
447 values ('s','$subject[$i]')";
448 my $sth2=$dbh->prepare($query);
453 $error="$subject[$i]\n does not exist in the subject authority file";
454 $query= "Select * from catalogueentry where
455 entrytype='s' and (catalogueentry like '$subject[$i] %' or
456 catalogueentry like '% $subject[$i] %' or catalogueentry like
458 my $sth2=$dbh->prepare($query);
461 while (my $data=$sth2->fetchrow_hashref){
462 $error=$error."<br>$data->{'catalogueentry'}";
465 # $error=$error."<br>$query";
471 my $query="Delete from bibliosubject where biblionumber=$bibnum";
473 my $sth=$dbh->prepare($query);
477 for (my $i=0;$i<$count;$i++){
478 $sth=$dbh->prepare("Insert into bibliosubject values ('$subject[$i]',$bibnum)");
479 # print $subject[$i];
489 my ($bibitemnum,$itemtype,$isbn,$publishercode,$publicationdate,$classification,$dewey,$subclass,$illus,$pages,$volumeddesc,$notes,$size,$place)=@_;
491 my $query="update biblioitems set itemtype='$itemtype',
492 isbn='$isbn',publishercode='$publishercode',publicationyear='$publicationdate',
493 classification='$classification',dewey='$dewey',subclass='$subclass',illus='$illus',
494 pages='$pages',volumeddesc='$volumeddesc',notes='$notes',size='$size',place='$place'
496 biblioitemnumber=$bibitemnum";
497 my $sth=$dbh->prepare($query);
505 my ($bibitemnum,$note)=@_;
507 my $query="update biblioitems set notes='$note' where
508 biblioitemnumber='$bibitemnum'";
509 my $sth=$dbh->prepare($query);
516 my ($biblioitem) = @_;
518 my $query = "Select max(biblioitemnumber) from biblioitems";
519 my $sth = $dbh->prepare($query);
523 $biblioitem->{'volume'} = $dbh->quote($biblioitem->{'volume'});
524 $biblioitem->{'number'} = $dbh->quote($biblioitem->{'number'});
525 $biblioitem->{'classification'} = $dbh->quote($biblioitem->{'classification'});
526 $biblioitem->{'itemtype'} = $dbh->quote($biblioitem->{'itemtype'});
527 $biblioitem->{'isbn'} = $dbh->quote($biblioitem->{'isbn'});
528 $biblioitem->{'issn'} = $dbh->quote($biblioitem->{'issn'});
529 $biblioitem->{'dewey'} = $dbh->quote($biblioitem->{'dewey'});
530 $biblioitem->{'subclass'} = $dbh->quote($biblioitem->{'subclass'});
531 $biblioitem->{'publicationyear'} = $dbh->quote($biblioitem->{'publicationyear'});
532 $biblioitem->{'publishercode'} = $dbh->quote($biblioitem->{'publishercode'});
533 $biblioitem->{'volumedate'} = $dbh->quote($biblioitem->{'volumedate'});
534 $biblioitem->{'volumeddesc'} = $dbh->quote($biblioitem->{'volumeddesc'}); $biblioitem->{'illus'} = $dbh->quote($biblioitem->{'illus'});
535 $biblioitem->{'pages'} = $dbh->quote($biblioitem->{'pages'});
536 $biblioitem->{'notes'} = $dbh->quote($biblioitem->{'notes'});
537 $biblioitem->{'size'} = $dbh->quote($biblioitem->{'size'});
538 $biblioitem->{'place'} = $dbh->quote($biblioitem->{'place'});
541 $data = $sth->fetchrow_arrayref;
542 $bibitemnum = $$data[0] + 1;
546 $query = "insert into biblioitems set
547 biblioitemnumber = $bibitemnum,
548 biblionumber = $biblioitem->{'biblionumber'},
549 volume = $biblioitem->{'volume'},
550 number = $biblioitem->{'number'},
551 classification = $biblioitem->{'classification'},
552 itemtype = $biblioitem->{'itemtype'},
553 isbn = $biblioitem->{'isbn'},
554 issn = $biblioitem->{'issn'},
555 dewey = $biblioitem->{'dewey'},
556 subclass = $biblioitem->{'subclass'},
557 publicationyear = $biblioitem->{'publicationyear'},
558 publishercode = $biblioitem->{'publishercode'},
559 volumedate = $biblioitem->{'volumedate'},
560 volumeddesc = $biblioitem->{'volumeddesc'},
561 illus = $biblioitem->{'illus'},
562 pages = $biblioitem->{'pages'},
563 notes = $biblioitem->{'notes'},
564 size = $biblioitem->{'size'},
565 place = $biblioitem->{'place'}";
567 $sth = $dbh->prepare($query);
578 my $query="insert into bibliosubject (biblionumber) values
580 my $sth=$dbh->prepare($query);
588 my ($bibnum, $subtitle) = @_;
590 $subtitle = $dbh->quote($subtitle);
591 my $query = "insert into bibliosubtitle set
592 biblionumber = $bibnum,
593 subtitle = $subtitle";
594 my $sth = $dbh->prepare($query);
603 my ($bibnum,$title,$ordnum,$basket,$quantity,$listprice,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$sub,$invoice)=@_;
604 if ($budget eq 'now'){
607 $budget="'2001-07-01'";
615 my $query="insert into aqorders (biblionumber,title,basketno,
616 quantity,listprice,booksellerid,entrydate,requisitionedby,authorisedby,notes,
617 biblioitemnumber,rrp,ecost,gst,budgetdate,unitprice,subscription,booksellerinvoicenumber)
620 ($bibnum,'$title',$basket,$quantity,$listprice,'$supplier',now(),
621 '$who','$who','$notes',$bibitemnum,'$rrp','$ecost','$gst',$budget,'$cost',
623 my $sth=$dbh->prepare($query);
627 $query="select * from aqorders where
628 biblionumber=$bibnum and basketno=$basket and ordernumber >=$ordnum";
629 $sth=$dbh->prepare($query);
631 my $data=$sth->fetchrow_hashref;
633 $ordnum=$data->{'ordernumber'};
634 $query="insert into aqorderbreakdown (ordernumber,bookfundid) values
635 ($ordnum,'$bookfund')";
636 $sth=$dbh->prepare($query);
644 my ($bibnum,$ordnum)=@_;
646 my $query="update aqorders set datecancellationprinted=now()
647 where biblionumber='$bibnum' and
648 ordernumber='$ordnum'";
649 my $sth=$dbh->prepare($query);
653 my $count=itemcount($bibnum);
661 my ($title,$ordnum,$quantity,$listprice,$bibnum,$basketno,$supplier,$who,$notes,$bookfund,$bibitemnum,$rrp,$ecost,$gst,$budget,$cost,$invoice)=@_;
663 my $query="update aqorders set title='$title',
664 quantity='$quantity',listprice='$listprice',basketno='$basketno',
665 rrp='$rrp',ecost='$ecost',unitprice='$cost',
666 booksellerinvoicenumber='$invoice'
668 ordernumber=$ordnum and biblionumber=$bibnum";
669 my $sth=$dbh->prepare($query);
673 $query="update aqorderbreakdown set bookfundid=$bookfund where
674 ordernumber=$ordnum";
675 $sth=$dbh->prepare($query);
684 my $query="Select max(ordernumber) from aqorders";
685 my $sth=$dbh->prepare($query);
687 my $data=$sth->fetchrow_arrayref;
688 my $ordnum=$$data[0];
696 my ($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno,$freight,$bookfund,$rrp)=@_;
698 my $query="update aqorders set quantityreceived='$quantrec',
699 datereceived=now(),booksellerinvoicenumber='$invoiceno',
700 biblioitemnumber=$bibitemno,unitprice='$cost',freight='$freight',
702 where biblionumber=$biblio and ordernumber=$ordnum
705 my $sth=$dbh->prepare($query);
708 $query="update aqorderbreakdown set bookfundid=$bookfund where
709 ordernumber=$ordnum";
710 $sth=$dbh->prepare($query);
717 my($biblio,$ordnum,$user,$cost,$bookfund,$rrp)=@_;
719 my $query="update aqorders set
720 unitprice='$cost', rrp='$rrp'
721 where biblionumber=$biblio and ordernumber=$ordnum
724 my $sth=$dbh->prepare($query);
727 $query="update aqorderbreakdown set bookfundid=$bookfund where
728 ordernumber=$ordnum";
729 $sth=$dbh->prepare($query);
737 my ($currency,$price)=@_;
739 my $query="Select rate from currency where currency='$currency'";
740 my $sth=$dbh->prepare($query);
742 my $data=$sth->fetchrow_hashref;
745 my $cur=$data->{'rate'};
749 $price=$price / $cur;
755 my $query="Select * from currency";
756 my $sth=$dbh->prepare($query);
760 while (my $data=$sth->fetchrow_hashref){
766 return($i,\@results);
772 my $query="Select * from currency where currency='$cur'";
773 my $sth=$dbh->prepare($query);
776 my $data=$sth->fetchrow_hashref;
782 sub updatecurrencies {
783 my ($currency,$rate)=@_;
785 my $query="update currency set rate=$rate where currency='$currency'";
786 my $sth=$dbh->prepare($query);
795 my $query="Update aqbooksellers set
796 name='$data->{'name'}',address1='$data->{'address1'}',address2='$data->{'address2'}',
797 address3='$data->{'address3'}',address4='$data->{'address4'}',postal='$data->{'postal'}',
798 phone='$data->{'phone'}',fax='$data->{'fax'}',url='$data->{'url'}',
799 contact='$data->{'contact'}',contpos='$data->{'contpos'}',
800 contphone='$data->{'contphone'}', contfax='$data->{'contfax'}', contaltphone=
801 '$data->{'contaltphone'}', contemail='$data->{'contemail'}', contnotes=
802 '$data->{'contnotes'}', active=$data->{'active'},
803 listprice='$data->{'listprice'}', invoiceprice='$data->{'invoiceprice'}',
804 gstreg=$data->{'gstreg'}, listincgst=$data->{'listincgst'},
805 invoiceincgst=$data->{'invoiceincgst'}, specialty='$data->{'specialty'}',
806 discount='$data->{'discount'}',invoicedisc='$data->{'invoicedisc'}',
807 nocalc='$data->{'nocalc'}'
808 where id='$data->{'id'}'";
809 my $sth=$dbh->prepare($query);
819 my $sth=$dbh->prepare("Select max(id) from aqbooksellers");
821 my $data2=$sth->fetchrow_hashref;
823 $data2->{'max(id)'}++;
824 $sth=$dbh->prepare("Insert into aqbooksellers (id) values ($data2->{'max(id)'})");
827 $data->{'id'}=$data2->{'max(id)'};
830 return($data->{'id'});
835 ($count,$bibitemno,$biblio,$replacement,$price,$booksellerid,$branch,$loan,@barcodes)=@_;
837 my $sth=$dbh->prepare("Select max(itemnumber) from items");
839 my $data=$sth->fetchrow_hashref;
840 my $item=$data->{'max(itemnumber)'};
844 for (my $i=0;$i<$count;$i++){
845 $barcodes[$i]=uc $barcodes[$i];
846 my $query="Insert into items (biblionumber,biblioitemnumber,itemnumber,barcode,
847 booksellerid,dateaccessioned,homebranch,holdingbranch,price,replacementprice,
848 replacementpricedate,notforloan) values
849 ($biblio,$bibitemno,$item,'$barcodes[$i]','$booksellerid',now(),'$branch',
850 '$branch','$price','$replacement',now(),$loan)";
851 my $sth=$dbh->prepare($query);
853 $error.=$sth->errstr;
863 my ($count,@barcodes)=@_;
866 for (my $i=0;$i<$count;$i++){
867 $barcodes[$i]=uc $barcodes[$i];
868 my $query="Select * from items where barcode='$barcodes[$i]'";
869 my $sth=$dbh->prepare($query);
871 if (my $data=$sth->fetchrow_hashref){
872 $error.=" Duplicate Barcode: $barcodes[$i]";
881 my ($loan,$itemnum,$bibitemnum,$barcode,$notes,$homebranch,$lost,$wthdrawn,$replacement)=@_;
883 my $query="update items set biblioitemnumber=$bibitemnum,
884 barcode='$barcode',itemnotes='$notes'
885 where itemnumber=$itemnum";
887 $query="update items set biblioitemnumber=$bibitemnum,notforloan=$loan where itemnumber=$itemnum";
890 $query="update items set biblioitemnumber=$bibitemnum,
891 barcode='$barcode',itemnotes='$notes',homebranch='$homebranch',
892 itemlost='$lost',wthdrawn='$wthdrawn' where itemnumber=$itemnum";
894 if ($replacement ne ''){
895 $query=~ s/ where/,replacementprice='$replacement' where/;
898 my $sth=$dbh->prepare($query);
905 my($price,$rrp,$itemnum)=@_;
907 my $query="update items set price='$price',replacementprice='$rrp'
908 where itemnumber=$itemnum";
909 my $sth=$dbh->prepare($query);
917 my $query="Select count(*) from items where biblioitemnumber='$bibitemnum'";
918 my $sth=$dbh->prepare($query);
920 my $data=$sth->fetchrow_hashref;
923 return($data->{'count(*)'});
927 my ($biblionumber)=@_;
929 my $query="Select * from biblioitems,items,itemtypes where
930 biblioitems.biblionumber=$biblionumber
931 and biblioitems.biblioitemnumber=items.biblioitemnumber and
932 itemtypes.itemtype=biblioitems.itemtype
933 order by items.biblioitemnumber";
934 my $sth=$dbh->prepare($query);
938 while (my $data=$sth->fetchrow_hashref){
948 my ($bibitemnum,$itemtype)=@_;
950 my $query="Select * from biblioitems where biblioitemnumber=$bibitemnum
951 and itemtype='$itemtype'";
952 my $sth=$dbh->prepare($query);
955 if (my $data=$sth->fetchrow_hashref){
966 my $query="select * from items where itemnumber=$itemnum";
967 my $sth=$dbh->prepare($query);
969 my @data=$sth->fetchrow_array;
971 $query="Insert into deleteditems values (";
972 foreach my $temp (@data){
973 $query=$query."'$temp',";
977 $sth=$dbh->prepare($query);
980 $query = "Delete from items where itemnumber=$itemnum";
981 $sth=$dbh->prepare($query);
990 my $query="select * from biblioitems where biblioitemnumber=$itemnum";
991 my $sth=$dbh->prepare($query);
993 if (my @data=$sth->fetchrow_array){
995 $query="Insert into deletedbiblioitems values (";
996 foreach my $temp (@data){
998 $query=$query."'$temp',";
1002 $sth=$dbh->prepare($query);
1005 $query = "Delete from biblioitems where biblioitemnumber=$itemnum";
1006 $sth=$dbh->prepare($query);
1017 my $query="select * from biblio where biblionumber=$biblio";
1018 my $sth=$dbh->prepare($query);
1020 if (my @data=$sth->fetchrow_array){
1022 $query="Insert into deletedbiblio values (";
1023 foreach my $temp (@data){
1024 $temp=~ s/\'/\\\'/g;
1025 $query=$query."'$temp',";
1029 $sth=$dbh->prepare($query);
1032 $query = "Delete from biblio where biblionumber=$biblio";
1033 $sth=$dbh->prepare($query);
1043 my $dbh = C4Connect;
1044 my $query = "select * from itemtypes";
1045 my $sth = $dbh->prepare($query);
1046 # || die "Cannot prepare $query" . $dbh->errstr;
1051 # || die "Cannot execute $query\n" . $sth->errstr;
1052 while (my $data = $sth->fetchrow_hashref) {
1053 $results[$count] = $data;
1059 return($count, @results);
1060 } # sub getitemtypes
1064 my ($biblionumber) = @_;
1065 my $dbh = C4Connect;
1066 my $query = "Select * from biblio where biblionumber = $biblionumber";
1067 my $sth = $dbh->prepare($query);
1068 # || die "Cannot prepare $query" . $dbh->errstr;
1073 # || die "Cannot execute $query" . $sth->errstr;
1074 while (my $data = $sth->fetchrow_hashref) {
1075 $results[$count] = $data;
1081 return($count, @results);
1085 END { } # module clean-up code here (global destructor)