X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=request.pl;h=fd2d644c4466a54abc12f7ffcbd402fb328142fa;hb=4d315418f2364446e09ee949ede1bf2a074958ca;hp=5bdaaa271d9cf7b5285338bb5d7b8a88c9dd3a71;hpb=157d4a34f0b1cae48eed4b44a9a562d8f2183946;p=koha.git diff --git a/request.pl b/request.pl index 5bdaaa271d..fd2d644c44 100755 --- a/request.pl +++ b/request.pl @@ -1,14 +1,34 @@ #!/usr/bin/perl +# $Id$ + #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; use C4::Output; use C4::Reserves2; -use C4::Acquisitions; +use C4::Biblio; use C4::Koha; use C4::Circulation::Circ2; @@ -21,6 +41,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 +55,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,39 +72,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 $bor=$reserves->[$i]{'firstname'}."%20".$reserves->[$i]{'surname'}; - #$bor=~ s/ /%20/g; - 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'}); @@ -99,38 +129,33 @@ 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'} $notes $date -$pickup +OO $pickup $type -$change EOF } @@ -145,7 +170,7 @@ sub priorityoptions { if ($sel == $i){ $out .= " selected"; } - $out .= ">$i\n"; + $out .= ">$i\n"; } return $out; } @@ -155,26 +180,32 @@ sub branchoptions { my ($selbr) = @_; my $out = ""; foreach my $br (keys %$branches) { - (next) unless $branches->{$br}->{'CU'}; + (next) unless $branches->{$br}->{'IS'}; + # Only branches with the 'IS' branchrelation + # can issue books 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'); @@ -188,12 +219,12 @@ print < Requesting:
-$dat->{'title'} +$dat->{'title'} ($dat->{'author'})

- + @@ -215,10 +246,10 @@ $priorityoptions -
Next Available, +Next Available,
(or choose from list below)
-

+ @@ -228,20 +259,20 @@ $branchoptions - - $bibitemrows
Item Type Classification VolumeISBNCopyright Pubdate Copies
-

+

 

- + + +
@@ -249,7 +280,6 @@ $bibitemrows - @@ -258,7 +288,6 @@ $bibitemrows - $existingreserves
MODIFY EXISTING REQUESTS
RankDate Pickup RequestChange To