From c74ad16d2eda38ec449d8f2ffddd35dbed82c0ad Mon Sep 17 00:00:00 2001 From: rangi Date: Wed, 20 Jun 2001 03:36:01 +0000 Subject: [PATCH] Made a little change to allow the reading record to be sorted, and now defaults to the last 50 items borrowed --- C4/Search.pm | 22 ++++++++++++++-------- readingrec.pl | 18 +++++++++++++++--- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 016dc6a6c1..fba21f773c 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -574,7 +574,7 @@ sub ItemInfo { and biblio.biblionumber='$biblionumber' and branches.branchcode= items.holdingbranch "; # print $type; - if ($type ne 'intra'){ + if ($type eq 'opac'){ $query.=" and (items.itemlost<>1 or items.itemlost is NULL) and (wthdrawn <> 1 or wthdrawn is NULL)"; } @@ -924,13 +924,18 @@ by date_due"; } sub allissues { - my ($bornum)=@_; + my ($bornum,$order,$limit)=@_; my $dbh=C4Connect; my $query; - $query="Select * from issues,biblio,items where borrowernumber='$bornum' and -items.itemnumber=issues.itemnumber and -items.biblionumber=biblio.biblionumber order -by date_due"; + $query="Select * from issues,biblio,items,biblioitems + where borrowernumber='$bornum' and + items.biblioitemnumber=biblioitems.biblioitemnumber and + items.itemnumber=issues.itemnumber and + items.biblionumber=biblio.biblionumber"; + $query.=" order by $order"; + if ($limit !=0){ + $query.=" limit $limit"; + } #print $query; my $sth=$dbh->prepare($query); $sth->execute; @@ -1036,7 +1041,7 @@ sub itemcount { my $dbh=C4Connect; my $query="Select * from items where biblionumber=$bibnum "; - if ($type ne 'intra'){ + if ($type eq 'opac'){ $query.=" and (itemlost <>1 or itemlost is NULL) and (wthdrawn <> 1 or wthdrawn is NULL)"; } @@ -1085,7 +1090,8 @@ sub itemcount { $sth2->finish; } # if ($count == 0){ - my $query2="Select * from aqorders where biblionumber=$bibnum"; + my $query2="Select * from aqorders where biblionumber=$bibnum and + datecancellationprinted is NULL"; my $sth2=$dbh->prepare($query2); $sth2->execute; if (my $data=$sth2->fetchrow_hashref){ diff --git a/readingrec.pl b/readingrec.pl index f01d93e082..22ed9020e8 100755 --- a/readingrec.pl +++ b/readingrec.pl @@ -14,7 +14,18 @@ my $input=new CGI; my $bornum=$input->param('bornum'); #get borrower details my $data=borrdata('',$bornum); -my ($count,$issues)=allissues($bornum); +my $order=$input->param('order'); +my $order2=$order; +if ($order2 eq ''){ + $order2="date_due desc"; +} +my $limit=$input->param('limit'); +if ($limit eq 'full'){ + $limit=0; +} else { + $limit=50; +} +my ($count,$issues)=allissues($bornum,$order2,$limit); print $input->header; @@ -23,9 +34,10 @@ print startmenu('member'); #print $count; print mkheadr(3,"$data->{'title'} $data->{'initials'} $data->{'surname'}"); print mktablehdr(); -print mktablerow(4,'white',bold('TITLE'),bold('AUTHOR'),bold('DATE')); +print mktablerow(1,'white',"Full output"); +print mktablerow(4,'white',"TITLE","AUTHOR","DATE","Volume"); for (my $i=0;$i<$count;$i++){ - print mktablerow(3,'white',$issues->[$i]->{'title'},$issues->[$i]->{'author'},$issues->[$i]->{'returndate'}); + print mktablerow(4,'white',$issues->[$i]->{'title'},$issues->[$i]->{'author'},$issues->[$i]->{'returndate'},$issues->[$i]->{'volumeddesc'}); } print mktableft(); print endmenu('member'); -- 2.39.5