[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/opac opac-reserve.pl,1.1.2.1,1.1.2.2
From: |
Finlay Thompson |
Subject: |
[Koha-cvs] CVS: koha/opac opac-reserve.pl,1.1.2.1,1.1.2.2 |
Date: |
Thu, 10 Oct 2002 22:24:30 -0700 |
Update of /cvsroot/koha/koha/opac
In directory usw-pr-cvs1:/tmp/cvs-serv27967
Modified Files:
Tag: rel-1-2
opac-reserve.pl
Log Message:
fixed so that it displays using itemtypes only
Index: opac-reserve.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-reserve.pl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** opac-reserve.pl 3 Oct 2002 03:53:06 -0000 1.1.2.1
--- opac-reserve.pl 11 Oct 2002 05:24:26 -0000 1.1.2.2
***************
*** 11,14 ****
--- 11,17 ----
use C4::Reserves2;
+ my $MAXIMUM_NUMBER_OF_RESERVES = 5;
+
+
my $query = new CGI;
***************
*** 39,45 ****
}
}
- $rank++;
- $template->param(rank => $rank);
--- 42,48 ----
}
}
+ $template->param(rank => $rank);
+ $rank++;
***************
*** 57,61 ****
(next) unless $branches->{$br}->{'IS'};
my $selected = "";
! if ($br eq $branch) {
$selected = "selected";
}
--- 60,64 ----
(next) unless $branches->{$br}->{'IS'};
my $selected = "";
! if ($br eq 'L') {
$selected = "selected";
}
***************
*** 64,109 ****
$template->param( branchoptions => $branchoptions);
! #get the bibitem data....
! my ($count,@data) = bibitems($biblionumber);
!
! foreach my $bibitem (@data) {
! my @barcodes = barcodes($bibitem->{'biblioitemnumber'});
! my $barcodestext = "";
! foreach my $num (@barcodes) {
! my $message = $num->{'itemlost'} == 1 ? "(lost)" :
! $num->{'itemlost'} == 2 ? "(long overdue)" :
"($branches->{$num->{'holdingbranch'}}->{'branchname'})";
! $barcodestext .= "$num->{'barcode'} $message <br>";
}
! $barcodestext = substr($barcodestext, 0, -4);
! $bibitem->{'copies'} = $barcodestext;
}
! my @reqbibs = $query->param('reqbib');
! if ($query->param('bibitemsselected')) {
! $template->param(bibitemsselected => 1);
! my @tempdata;
! foreach my $bibitem (@data) {
! foreach my $reqbib (@reqbibs){
! push @tempdata, $bibitem if ($bibitem->{'biblioitemnumber'} ==
$reqbib) ;
}
}
! @data = @tempdata;
! } elsif ($query->param('placereserve')) {
! # here we actually do the reserveration....
my $title = $bibdata->{'title'};
CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',address@hidden,$rank,'',$title);
warn "reserve created\n";
print $query->redirect("/cgi-bin/koha/opac-user.pl");
} else {
! $template->param(selectbibitems => 1);
}
- # check that you can actually make the reserve.
-
-
- $template->param(BIBLIOITEMS => address@hidden);
$template->param(loggedinuser => $loggedinuser);
--- 67,162 ----
$template->param( branchoptions => $branchoptions);
+ #### THIS IS A BIT OF A HACK BECAUSE THE BIBLIOITEMS DATA IS A LITTLE MESSED
UP!
+ # get the itemtype data....
+ my @items = ItemInfo(undef, $biblionumber, 'intra');
+ my %types;
+ foreach my $itm (@items) {
+ my $ity = $itm->{'itemtype'};
+ unless ($types {$ity}) {
+ $types{$ity}->{'itemtype'} = $ity;
+ $types{$ity}->{'branchinfo'}->{$itm->{'branchcode'}} = 1;
+ $types{$ity}->{'description'} = $itm->{'description'};
+ } else {
+ $types{$ity}->{'branchinfo'}->{$itm->{'branchcode'}} ++;
+ }
+ }
! foreach my $type (values %types) {
! my $copies = "";
! foreach my $bc (keys %{$type->{'branchinfo'}}) {
! $copies .=
$branches->{$bc}->{'branchname'}."(".$type->{'branchinfo'}->{$bc}.")";
}
! $type->{'copies'} = $copies;
}
+ my @types = values %types;
! if ($query->param('item_types_selected')) {
! # this is what happens after the itemtypes have been selected. Stage 2
! my @itemtypes = $query->param('itemtype');
! if (@itemtypes) {
! warn "Itemtypes : @itemtypes\n";
! my %newtypes;
! foreach my $itmtype (@itemtypes) {
! $newtypes{$itmtype} = $types{$itmtype};
}
+ my @types = values %newtypes;
+ $template->param(TYPES => address@hidden);
+ $template->param(item_types_selected => 1);
+ } else {
+ $template->param(message => 1);
+ $template->param(no_items_selected => 1);
}
!
!
! } elsif ($query->param('place_reserve')) {
! # here we actually do the reserveration. Stage 3.
my $title = $bibdata->{'title'};
+ my @reqbibs;
+ my @itemtypes = $query->param('itemtype');
+ foreach my $item (@items) {
+ foreach my $type (@itemtypes) {
+ if ($item->{'itemtype'} == $type) {
+ my $addbibitem = 1;
+ foreach my $bibitemno (@reqbibs) {
+ $addbibitem = 0 if $bibitemno ==
$item->{'biblioitemnumber'};
+ }
+ push @reqbibs, $item->{'biblioitemnumber'} if $addbibitem;
+ }
+ }
+ }
CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',address@hidden,$rank,'',$title);
warn "reserve created\n";
print $query->redirect("/cgi-bin/koha/opac-user.pl");
} else {
! # Here we check that the borrower can actually make reserves Stage 1.
! my $noreserves = 0;
! if ($borr->{'amountoutstanding'} > 5) {
! my $amount = sprintf "\$%.02f", $borr->{'amountoutstanding'};
! $template->param(message => 1);
! $noreserves = 1;
! $template->param(too_much_oweing => $amount);
! }
! my ($resnum, $reserves) = FindReserves(undef, $borrowernumber);
! $template->param(RESERVES => $reserves);
! if ($resnum >= $MAXIMUM_NUMBER_OF_RESERVES) {
! $template->param(message => 1);
! $noreserves = 1;
! $template->param(too_many_reserves => $resnum);
! }
! foreach my $res (@$reserves) {
! if ($res->{'biblionumber'} == $biblionumber) {
! $template->param(message => 1);
! $noreserves = 1;
! $template->param(already_reserved => 1);
! }
! }
! $template->param(TYPES => address@hidden);
! unless ($noreserves) {
! $template->param(select_item_types => 1);
! }
}
$template->param(loggedinuser => $loggedinuser);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/opac opac-reserve.pl,1.1.2.1,1.1.2.2,
Finlay Thompson <=