From 7a3ac6ddfcdaf4fe9e9a0fab45a0f2f7b1b7b8b0 Mon Sep 17 00:00:00 2001 From: finlayt Date: Thu, 6 Jun 2002 23:30:39 +0000 Subject: [PATCH] rewrite, so that it correctly displays branches and waiting reserves. --- request.pl | 331 +++++++++++++++++++++++++++++------------------------ 1 file changed, 183 insertions(+), 148 deletions(-) diff --git a/request.pl b/request.pl index b727002f0f..e549aa1d6d 100755 --- a/request.pl +++ b/request.pl @@ -10,38 +10,192 @@ use C4::Output; use C4::Reserves2; use C4::Acquisitions; use C4::Koha; +use C4::Circulation::Circ2; use CGI; my $input = new CGI; + +# get biblio information.... +my $bib = $input->param('bib'); +my $dat = bibdata($bib); + +# get existing reserves ..... +my ($count,$reserves) = FindReserves($bib); +foreach my $res (@$reserves) { + if ($res->{'found'} eq 'W') { + $count--; + } +} + +# make priorities options +my $num = $count + 1; +my $priorityoptions = priorityoptions($num, $num); + + +# get branch information +my $branch = $input->cookie('branch'); +my $branches = getbranches(); + +warn $branch; + +my $branchoptions = branchoptions($branch); + + +# todays date +my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time); +$year=$year+1900; +$mon++; +my $date="$mday/$mon/$year"; + + + + +# get biblioitem information and build rows for form +my ($count2,@data) = bibitems($bib); +my $bibitemrows = ""; +for (my $i=0; $i<$count2; $i++){ + my @barcodes = barcodes($data[$i]->{'biblioitemnumber'}); + if ($data[$i]->{'dewey'} == 0){ + $data[$i]->{'dewey'}=""; + } + $data[$i]->{'dewey'}=~ s/\.0000$//; + $data[$i]->{'dewey'}=~ s/00$//; + my $class="$data[$i]->{'classification'}$data[$i]->{'dewey'}$data[$i]->{'subclass'}"; + $bibitemrows .= <<"EOF"; + +{'biblioitemnumber'}> +{'biblioitemnumber'}> + +$data[$i]->{'description'} +$class +$data[$i]->{'volumeddesc'} +$data[$i]->{'isbn'} +$dat->{'copyrightdate'} +$data[$i]->{'publicationyear'} +@barcodes + +EOF +} + + + +my $existingreserves = ""; +foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){ + #my $bor=$reserves->[$i]{'firstname'}."%20".$reserves->[$i]{'surname'}; + #$bor=~ s/ /%20/g; + my $prioropt = priorityoptions($count, $res->{'priority'}); + my $bropt = branchoptions($res->{'branchcode'}); + warn $res->{'branchcode'}; + my $bor=$res->{'borrowernumber'}; + $date = slashifyDate($res->{'reservedate'}); + + my $type=$res->{'constrainttype'}; + if ($type eq 'a'){ + $type='Next Available'; + } elsif ($type eq 'o'){ + $type="This type only $res->{'volumeddesc'} $res->{'itemtype'}"; + } + + my $notes = $res->{'reservenotes'}." "; + my $rank; + my $pickup; + my $change; + if ($res->{'found'} eq 'W') { + my %env; + my $item = $res->{'itemnumber'}; + $item = getiteminformation(\%env,$item); + $item = "{'biblionumber'} &type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$item->{'barcode'}"; + my $wbra = $branches->{$res->{'branchcode'}}->{'branchname'}; + $rank = "Item waiting"; + $type = $item; + $pickup = "at ".$wbra.""; + $change = "delete"; + } else { + $rank = ""; + $pickup = ""; + $change = ""; + } + $existingreserves .= <<"EOF"; +{'borrowernumber'}> +{'biblionumber'}> + +$rank + +$res->{'firstname'} $res->{'surname'} + +$notes +$date +$pickup +$type +$change + +EOF +} + + + +sub priorityoptions { + my ($count, $sel) = @_; + my $out = ""; + for (my $i=1; $i<=$count; $i++){ + $out .= "