From 89cbfd3cd0d50b2e5387020da43f25a2199a88cc Mon Sep 17 00:00:00 2001 From: rangi Date: Mon, 10 Sep 2001 23:37:09 +0000 Subject: [PATCH] Fixing a glitch that was showing the biblio notes field where the biblioitems notes should have been displaying --- C4/Search.pm | 52 +++++++++++++++++++++++++++++++++++++-------------- modbibitem.pl | 2 +- moredetail.pl | 11 +++++++---- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index fba21f773c..33bf7dd100 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -19,7 +19,8 @@ $VERSION = 0.01; &itemdata &bibdata &GetItems &borrdata &getacctlist &itemnodata &itemcount &OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues &getboracctrecord &ItemType &itemissues &FrontSearch &subject &subtitle -&addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs); +&addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs +&findguarantor); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], # your exported package globals go here, @@ -72,6 +73,24 @@ sub findguarantees{ return($i,\@dat); } +sub findguarantor{ + my ($bornum)=@_; + my $dbh=C4Connect; + my $query="select guarantor from borrowers where + borrowernumber='$bornum'"; + my $sth=$dbh->prepare($query); + $sth->execute; + my $data=$sth->fetchrow_hashref; + $sth->finish; + $query="Select * from borrowers where borrowernumber='$data->{'guarantor'}'"; + $sth=$dbh->prepare($query); + $sth->execute; + $data=$sth->fetchrow_hashref; + $sth->finish; + $dbh->disconnect; + return($data); +} + sub NewBorrowerNumber { my $dbh=C4Connect; my $sth=$dbh->prepare("Select max(borrowernumber) from borrowers"); @@ -214,9 +233,12 @@ sub KeywordSearch { my $count=@key; my $i=1; my @results; - my $query ="Select * from biblio,bibliosubtitle,biblioitems where - biblio.biblionumber=bibliosubtitle.biblionumber and - biblioitems.biblionumber=biblio.biblionumber and + my $query ="Select * from biblio + left join bibliosubtitle on + bibliosubtitle.biblionumber=biblio.biblionumber + left join biblioitems on + biblioitems.biblionumber=biblio.biblionumber + where (((title like '$key[0]%' or title like '% $key[0]%')"; while ($i < $count){ $query=$query." and (title like '$key[$i]%' or title like '% $key[$i]%')"; @@ -344,11 +366,11 @@ sub CatSearch { my $count=@key; my $i=1; $query="select *,biblio.author,biblio.biblionumber from - biblioitems,biblio + biblio left join additionalauthors on additionalauthors.biblionumber =biblio.biblionumber - where biblioitems.biblionumber=biblio.biblionumber - and + left join biblioitems on biblioitems.biblionumber=biblio.biblionumber + where ((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%' or additionalauthors.author like '$key[0]%' or additionalauthors.author like '% $key[0]%' @@ -396,10 +418,11 @@ sub CatSearch { my @key=split(' ',$search->{'title'}); my $count=@key; my $i=1; - $query="select * from biblio,bibliosubtitle,biblioitems + $query="select * from biblio + left join bibliosubtitle on + bibliosubtitle.biblionumber=biblio.biblionumber + left join biblioitems on biblioitems.biblionumber=biblio.biblionumber where - (biblio.biblionumber=bibliosubtitle.biblionumber and - biblioitems.biblionumber=biblio.biblionumber) and (((title like '$key[0]%' or title like '% $key[0]%' or title like '% $key[0]')"; while ($i<$count){ $query=$query." and (title like '$key[$i]%' or title like '% $key[$i]%' or title like '% $key[$i]')"; @@ -713,7 +736,8 @@ sub bibdata { sub bibitemdata { my ($bibitem)=@_; my $dbh=C4Connect; - my $query="Select * from biblio,biblioitems,itemtypes where biblio.biblionumber= + my $query="Select *, biblioitems.notes as bnotes + from biblio,biblioitems,itemtypes where biblio.biblionumber= biblioitems.biblionumber and biblioitemnumber=$bibitem and biblioitems.itemtype=itemtypes.itemtype"; # print $query; @@ -1042,8 +1066,8 @@ sub itemcount { my $query="Select * from items where biblionumber=$bibnum "; if ($type eq 'opac'){ - $query.=" and (itemlost <>1 or itemlost is NULL) and - (wthdrawn <> 1 or wthdrawn is NULL)"; + $query.=" and (itemlost =0 or itemlost is NULL) and + (wthdrawn = 0 or wthdrawn is NULL)"; } my $sth=$dbh->prepare($query); # print $query; @@ -1077,7 +1101,7 @@ sub itemcount { if ($data->{'holdingbranch'} eq 'S' || $data->{'holdingbranch'} eq 'SP'){ $scount++; } - if ($data->{'itemlost'} eq '1'){ + if ($data->{'itemlost'} eq '1' || $data->{'itemlost'} eq '2'){ $lostcount++; } if ($data->{'holdingbranch'} eq 'FM'){ diff --git a/modbibitem.pl b/modbibitem.pl index c87d8ccebb..899964dd1c 100755 --- a/modbibitem.pl +++ b/modbibitem.pl @@ -112,7 +112,7 @@ print <Volume Notes - + Size diff --git a/moredetail.pl b/moredetail.pl index d89dd2ae0b..a279784200 100755 --- a/moredetail.pl +++ b/moredetail.pl @@ -34,7 +34,7 @@ my $bi=$input->param('bi'); my $data=bibitemdata($bi); my (@items)=itemissues($bi); -my ($order)=getorder($bi,$bib); +my ($order,$ordernum)=getorder($bi,$bib); #print @items; my $count=@items; @@ -88,8 +88,9 @@ print <Pages: $data->{'pages'}
Illus: $data->{'illus'}
Size: $data->{'size'}
-Notes: $data->{'notes'}
+Notes: $data->{'bnotes'}
No. of Items: $count + printend ; if ($type eq 'catmain'){ @@ -97,6 +98,7 @@ if ($type eq 'catmain'){ } print < @@ -117,6 +119,7 @@ print < {'itemnumber'}> +
@@ -153,10 +156,10 @@ print <Current Branch: $items[$i]->{'holdingbranch'}
Replacement Price: $items[$i]->{'replacementprice'}
Item lost: $items[$i]->{'itemlost'}
-paid by:
+Paid for: $items[$i]->{'paidfor'}
Notes: $items[$i]->{'itemnotes'}
Renewals: $items[$i]->{'renewals'}
-{'ordernumber'}&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
+{'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
printend ; if ($items[$i]->{'wthdrawn'} eq '1'){ -- 2.39.5