X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=request.pl;h=8ed764e4400493205589bba0e06119e6f472eab1;hb=a9e5b8bb7697b295755a149b311fd8b8ab6b8687;hp=b96ff9c187357f1255e8a5661e3a41812b41f680;hpb=ee915e6d7c0b64b14601dd5a83dcf2168bdc2d60;p=koha.git diff --git a/request.pl b/request.pl index b96ff9c187..8ed764e440 100755 --- a/request.pl +++ b/request.pl @@ -3,6 +3,24 @@ #script to place reserves/requests #writen 2/1/00 by chris@katipo.oc.nz + +# Copyright 2000-2002 Katipo Communications +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + use strict; #use DBI; use C4::Search; @@ -21,6 +39,7 @@ my $dat = bibdata($bib); # get existing reserves ..... my ($count,$reserves) = FindReserves($bib); +my $totalcount = $count; foreach my $res (@$reserves) { if ($res->{'found'} eq 'W') { $count--; @@ -34,10 +53,8 @@ my $priorityoptions = priorityoptions($num, $num); # get branch information my $branch = $input->cookie('branch'); +($branch) || ($branch = 'L'); my $branches = getbranches(); - -warn $branch; - my $branchoptions = branchoptions($branch); @@ -53,37 +70,50 @@ 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'}=""; + + +foreach my $dat (sort {$b->{'dateaccessioned'} cmp $a->{'dateaccessioned'}} @data) { + my @barcodes = barcodes($dat->{'biblioitemnumber'}); + my $barcodestext = ""; + foreach my $num (@barcodes) { + my $message = $num->{'itemlost'} == 1 ? "(lost)" : + $num->{'itemlost'} == 2 ? "(long overdue)" : ""; + $barcodestext .= "$num->{'barcode'} $message
"; + } + $barcodestext = substr($barcodestext, 0, -4); + + $dat->{'dewey'}="" if ($dat->{'dewey'} == 0); + + $dat->{'volumeddesc'} = " " unless $dat->{'volumeddesc'}; + $dat->{'dewey'}=~ s/\.0000$//; + $dat->{'dewey'}=~ s/00$//; + my $class="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}"; + my $select; + if (($dat->{'notforloan'}) + || ($dat->{'itemlost'} == 1)) { + $select = "Cannot be reserved."; + } else { + $select = " {'biblioitemnumber'}>{'biblioitemnumber'}>"; } - $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'} +$select +$dat->{'description'} $class -$data[$i]->{'volumeddesc'} -$data[$i]->{'isbn'} -$dat->{'copyrightdate'} -$data[$i]->{'publicationyear'} -@barcodes +$dat->{'volumeddesc'} +$dat->{'publicationyear'} +$barcodestext EOF } + my $existingreserves = ""; foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){ - my $prioropt = priorityoptions($count, $res->{'priority'}); + my $prioropt = priorityoptions($totalcount, $res->{'priority'}); my $bropt = branchoptions($res->{'branchcode'}); - warn $res->{'branchcode'}; my $bor=$res->{'borrowernumber'}; $date = slashifyDate($res->{'reservedate'}); @@ -97,30 +127,26 @@ foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){ 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"; + my $wbrcd = $res->{'branchcode'}; + my $wbra = $branches->{$wbrcd}->{'branchname'}; $type = $item; - $pickup = "at ".$wbra.""; - $change = "delete"; + $rank = ""; + $pickup = "Item waiting at ".$wbra." "; } else { - $rank = ""; + $rank = ""; $pickup = ""; - $change = ""; } $existingreserves .= <<"EOF"; + + {'borrowernumber'}> {'biblionumber'}> - -$rank +$rank $res->{'firstname'} $res->{'surname'} @@ -128,7 +154,6 @@ foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){ $date $pickup $type -$change EOF } @@ -143,7 +168,7 @@ sub priorityoptions { if ($sel == $i){ $out .= " selected"; } - $out .= ">$i\n"; + $out .= ">$i\n"; } return $out; } @@ -153,26 +178,30 @@ sub branchoptions { my ($selbr) = @_; my $out = ""; foreach my $br (keys %$branches) { - (next) unless $branches->{$br}->{'CU'}; + (next) unless $branches->{$br}->{'IS'}; my $selected = ""; if ($br eq $selbr) { $selected = "selected"; } - $out .= "\n"; } return $out; } +#get the time for the form name... +my $time = time(); + # printout the page -print $input->header; + + +print $input->header(-expires=>'now'); #setup colours -print startpage(); print startmenu('catalogue'); @@ -191,7 +220,7 @@ print < - + @@ -216,7 +245,7 @@ $branchoptions
Next Available,
(or choose from list below)
-

+ @@ -226,20 +255,20 @@ $branchoptions - - $bibitemrows
Item Type Classification VolumeISBNCopyright Pubdate Copies
-

+

 

- + + +
@@ -247,7 +276,6 @@ $bibitemrows - @@ -256,7 +284,6 @@ $bibitemrows - $existingreserves
MODIFY EXISTING REQUESTS
RankDate Pickup RequestChange To