require Exporter;
use CGI;
use C4::Biblio;
+use C4::Items;
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;
use C4::Circulation;
my %itemtypes;
my @duedates;
#die @items;
+my %itemhash;
+my $forloan;
foreach my $itm (@items) {
push @duedates, { date_due => format_date( $itm->{'date_due'} ) }
if defined $itm->{'date_due'};
$itm->{ $itm->{'publictype'} } = 1;
+ warn $itm->{'notforloan'};
my $fee = GetReserveFee( undef, $borrowernumber, $itm->{'biblionumber'},
'a', ( $itm->{'biblioitemnumber'} ) );
$fee = sprintf "%.02f", $fee;
push @{ $types{$pty}->{'items'} }, $itm;
}
}
+ $itemhash{$itm->{'itemnumber'}}=$itm;
+ if (!$itm->{'notforloan'} && !$itm->{'itemnotforloan'}){
+ $forloan=1;
+ }
}
$template->param( ITEMS => \@duedates );
} else {
AddReserve($branch,$borrowernumber,$biblionumber,'a',\@realbi,$rank,$notes,$bibdata->{'title'},$checkitem, $found);
}
- print $query->redirect("/cgi-bin/koha/opac-user.pl");
+ print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-holds");
}
else {
}
my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
$template->param( RESERVES => \@reserves );
- if ( scalar(@$reserves) >= $MAXIMUM_NUMBER_OF_RESERVES ) {
+ if ( scalar(@reserves) >= $MAXIMUM_NUMBER_OF_RESERVES ) {
$template->param( message => 1 );
$noreserves = 1;
- $template->param( too_many_reserves => scalar($reserves));
+ $template->param( too_many_reserves => scalar(@reserves));
}
- foreach my $res (@$reserves) {
- if ( $res->{'biblionumber'} == $biblionumber ) {
+ foreach my $res (@reserves) {
+ if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) {
$template->param( message => 1 );
$noreserves = 1;
$template->param( already_reserved => 1 );
foreach
my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } )
{
- my $item = $iteminfos_of->{$itemnumber};
+ my $item = $itemhash{$itemnumber};
$item->{homebranchname} =
$branches->{ $item->{homebranch} }{branchname};
}
# Management of the notforloan document
- if ( $item->{notforloan} ) {
+ if ( $item->{notforloan} || $item->{itemnotforloan}) {
$item->{backgroundcolor} = 'other';
$item->{notforloanvalue} =
$notforloan_label_of->{ $item->{notforloan} };
# FIXME: move this to a pm
my $dbh = C4::Context->dbh;
- my $sth2 = $dbh->prepare("SELECT * FROM reserves WHERE borrowernumber=? AND itemnumber=? AND found='W' AND cancellationdate IS NULL");
+ my $sth2 = $dbh->prepare("SELECT * FROM reserves WHERE borrowernumber=? AND itemnumber=? AND found='W'");
$sth2->execute($item->{ReservedForBorrowernumber},$item->{itemnumber});
while (my $wait_hashref = $sth2->fetchrow_hashref) {
$item->{waitingdate} = format_date($wait_hashref->{waitingdate});
}
-
+ $item->{imageurl} = getitemtypeimagesrc() . "/".$itemtypes->{ $item->{itype} }{imageurl};
push @{ $biblioitem->{itemloop} }, $item;
}
# display infos
$template->param(
+ forloan => $forloan,
bibitemloop => \@bibitemloop,
);
output_html_with_http_headers $query, $cookie, $template->output;