From 1034c5b91c263620d36d1a92e9d50d3fc1e786f2 Mon Sep 17 00:00:00 2001 From: finlayt Date: Tue, 15 Oct 2002 04:43:09 +0000 Subject: [PATCH] more fixes according to hlt requests --- opac/opac-reserve.pl | 24 ++++++++++++++++-------- opac/opac-user.pl | 9 ++++----- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index f0fae33e5e..2ab5de3262 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -108,30 +108,38 @@ if ($query->param('item_types_selected')) { my @types = values %newtypes; $template->param(TYPES => \@types); $template->param(item_types_selected => 1); + + my %reqbibs; + foreach my $item (@items) { + foreach my $type (@itemtypes) { + if ($item->{'itemtype'} == $type) { + $reqbibs{$item->{'biblioitemnumber'}} = 1; + } + } + } + my @reqbibs = keys %reqbibs; + my $fee = CalcReserveFee(undef,$borrowernumber,$biblionumber,'o',\@reqbibs); + $fee = sprintf "%.02f", $fee; + $template->param(fee => $fee); } 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 %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; + $reqbibs{$item->{'biblioitemnumber'}} = 1; } } } + my @reqbibs = keys %reqbibs; CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$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. diff --git a/opac/opac-user.pl b/opac/opac-user.pl index b8b240e67a..dd9158ec49 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -29,13 +29,12 @@ $borr->{'ethnicity'} = fixEthnicity($borr->{'ethnicity'}); if ($borr->{'amountoutstanding'} > 5) { $borr->{'amountoverfive'} = 1; -} else { - $borr->{'amountoverfive'} = 0; } -if ($borr->{'amountoutstanding'} > 0) { +if (5 >= $borr->{'amountoutstanding'} && $borr->{'amountoutstanding'} > 0 ) { $borr->{'amountoverzero'} = 1; -} else { - $borr->{'amountoverzero'} = 0; +} +if ($borr->{'amountoutstanding'} < 0) { + $borr->{'amountlessthanzero'} = 1; $borr->{'amountoutstanding'} = -1*($borr->{'amountoutstanding'}); } -- 2.39.5