[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.7,1.1.2.8
From: |
Finlay Thompson |
Subject: |
[Koha-cvs] CVS: koha/opac opac-reserve.pl,1.1.2.7,1.1.2.8 |
Date: |
Thu, 28 Nov 2002 02:52:37 -0800 |
Update of /cvsroot/koha/koha/opac
In directory sc8-pr-cvs1:/tmp/cvs-serv30556
Modified Files:
Tag: rel-1-2
opac-reserve.pl
Log Message:
Lots of fixing
Index: opac-reserve.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-reserve.pl,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -r1.1.2.7 -r1.1.2.8
*** opac-reserve.pl 27 Nov 2002 20:55:35 -0000 1.1.2.7
--- opac-reserve.pl 28 Nov 2002 10:52:35 -0000 1.1.2.8
***************
*** 75,144 ****
#### 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 $itemcount = @items;
$template->param(itemcount => $itemcount);
my %types;
foreach my $itm (@items) {
! $itm->{'datedue'} = slashifyDate($itm->{'datedue'});
! 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'}} ++;
}
}
! $template->param(ITEMS => address@hidden);
! 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);
!
! 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',address@hidden);
$fee = sprintf "%.02f", $fee;
$template->param(fee => $fee);
} else {
$template->param(message => 1);
$template->param(no_items_selected => 1);
}
- my $required_date=join '-', $query->param('required-year'),
$query->param('required-month'), $query->param('required-day');
- my $expires_date=join '-', $query->param('expires-year'),
$query->param('expires-month'), $query->param('expires-day');
- ($query->param('required-year')) || ($required_date='');
- ($query->param('expires-year')) || ($expires_date='');
- warn "REQ: $required_date\n";
- $template->param(required_date=> $required_date,
- expires_date => $expires_date);
--- 75,173 ----
#### 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, 'opac');
! my @temp;
! foreach my $itm (@items) {
! push @temp, $itm if $itm->{'itemtype'};
! }
! @items = @temp;
my $itemcount = @items;
$template->param(itemcount => $itemcount);
my %types;
+ my %itemtypes;
+ my @duedates;
foreach my $itm (@items) {
! push @duedates, {date_due => slashifyDate($itm->{'date_due'})} if defined
$itm->{'date_due'};
! $itm->{$itm->{'publictype'}} = 1;
! my $fee = CalcReserveFee(undef, $borrowernumber,
$itm->{'biblionumber'},'a',($itm->{'biblioitemnumber'}));
! $fee = sprintf "%.02f", $fee;
! $itm->{'reservefee'} = $fee;
! my $pty = $itm->{'publictype'};
! $itemtypes{$itm->{'itemtype'}} = $itm;
! unless ($types {$pty}) {
! $types{$pty}->{'count'} = 1;
! $types{$pty}->{$itm->{'itemtype'}} = 1;
! push @{$types{$pty}->{'items'}}, $itm;
} else {
! unless ($types{$pty}->{$itm->{'itemtype'}}) {
! $types{$pty}->{'count'}++;
! $types{$pty}->{$itm->{'itemtype'}} = 1;
! push @{$types{$pty}->{'items'}}, $itm;
! }
}
}
! $template->param(ITEMS => address@hidden);
! my $width = keys %types;
! my @publictypes = sort {$b->{'count'} <=> $a->{'count'}} values %types;
! my $typecount;
! foreach my $pt (@publictypes) {
! $typecount += $pt->{'count'};
}
+ $template->param(onlyone => 1) if $typecount == 1;
! my @typerows;
! for (my $rownum=0;$rownum<$publictypes[0]->{'count'} ;$rownum++) {
! my @row;
! foreach my $pty (@publictypes) {
! my @items = @{$pty->{'items'}};
! push @row, $items[$rownum] if defined $items[$rownum];
! }
! my $last = @row;
! $row[$last-1]->{'last'} =1 if $last == $width;
! my $fill = ($width - $last)*2;
! $fill-- if $fill;
! push @typerows, {ROW => address@hidden, fill => $fill};
! }
! $template->param(TYPE_ROWS => address@hidden);
! $width = 2*$width -1;
! $template->param(totalwidth => 2*$width-1);
if ($query->param('item_types_selected')) {
# this is what happens after the itemtypes have been selected. Stage 2
my @itemtypes = $query->param('itemtype');
+ my $fee = 0;
+ my $proceed = 0;
if (@itemtypes) {
my %newtypes;
foreach my $itmtype (@itemtypes) {
! $newtypes{$itmtype} = $itemtypes{$itmtype};
}
my @types = values %newtypes;
$template->param(TYPES => address@hidden);
! foreach my $type (@itemtypes) {
! my @reqbibs;
! foreach my $item (@items) {
! if ($item->{'itemtype'} eq $type) {
! push @reqbibs, $item->{'biblioitemnumber'};
}
}
+ $fee +=
CalcReserveFee(undef,$borrowernumber,$biblionumber,'o',address@hidden);
}
! $proceed = 1;
! } elsif ($query->param('all')) {
! $template->param(all => 1);
! $fee = 1;
! $proceed = 1;
! }
! if ($proceed) {
$fee = sprintf "%.02f", $fee;
$template->param(fee => $fee);
+ $template->param(item_types_selected => 1);
} else {
$template->param(message => 1);
$template->param(no_items_selected => 1);
}
***************
*** 146,162 ****
# 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) {
! $reqbibs{$item->{'biblioitemnumber'}} = 1;
}
}
}
- my @reqbibs = keys %reqbibs;
- my $required_date=$query->param('required_date');
- my $expires_date=$query->param('expires_date');
-
CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',address@hidden,$rank,'',$title,
$required_date, $expires_date);
print $query->redirect("/cgi-bin/koha/opac-user.pl");
} else {
--- 175,191 ----
# here we actually do the reserveration. Stage 3.
my $title = $bibdata->{'title'};
my @itemtypes = $query->param('itemtype');
! foreach my $type (@itemtypes) {
! my @reqbibs;
! foreach my $item (@items) {
! if ($item->{'itemtype'} eq $type) {
! push @reqbibs, $item->{'biblioitemnumber'};
}
}
+
CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',address@hidden,$rank,'',$title);
+ }
+ if ($query->param('all')) {
+ CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'a', undef,
$rank,'',$title);
}
print $query->redirect("/cgi-bin/koha/opac-user.pl");
} else {
***************
*** 183,187 ****
}
}
- $template->param(TYPES => address@hidden);
unless ($noreserves) {
$template->param(select_item_types => 1);
--- 212,215 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/opac opac-reserve.pl,1.1.2.7,1.1.2.8,
Finlay Thompson <=
- Prev by Date:
[Koha-cvs] CVS: koha/koha-tmpl/opac-tmpl/hlt/en/includes main.css,1.1.2.4,1.1.2.5
- Next by Date:
[Koha-cvs] CVS: koha/C4 Search.pm,1.18.2.19,1.18.2.20 Reserves2.pm,1.5.2.13,1.5.2.14
- Previous by thread:
[Koha-cvs] CVS: koha/koha-tmpl/opac-tmpl/hlt/en/includes main.css,1.1.2.4,1.1.2.5
- Next by thread:
[Koha-cvs] CVS: koha/C4 Search.pm,1.18.2.19,1.18.2.20 Reserves2.pm,1.5.2.13,1.5.2.14
- Index(es):