From 22e024026d6a23d309b9ce85787e5a074441f82a Mon Sep 17 00:00:00 2001 From: finlayt Date: Tue, 18 Mar 2003 20:57:52 +0000 Subject: [PATCH] fixed so that it works with the old templates too --- opac/opac-reserve.pl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index f6b2d58a94..5b80176394 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -82,6 +82,34 @@ $template->param(BRANCHES => \@branches); #### 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'); + +####################################################### +# old version, add so that old templates still work +my %types_old; +foreach my $itm (@items) { + my $ity = $itm->{'itemtype'}; + unless ($types_old {$ity}) { + $types_old{$ity}->{'itemtype'} = $ity; + $types_old{$ity}->{'branchinfo'}->{$itm->{'branchcode'}} = 1; + $types_old{$ity}->{'description'} = $itm->{'description'}; + } else { + $types_old{$ity}->{'branchinfo'}->{$itm->{'branchcode'}} ++; + } +} + +foreach my $type (values %types_old) { + my $copies = ""; + foreach my $bc (keys %{$type->{'branchinfo'}}) { + $copies .= $branches->{$bc}->{'branchname'}."(".$type->{'branchinfo'}->{$bc}.")"; + } + $type->{'copies'} = $copies; +} + +my @types_old = values %types_old; + +# end old version +################################ + my @temp; foreach my $itm (@items) { push @temp, $itm if $itm->{'itemtype'}; @@ -221,9 +249,11 @@ if ($query->param('item_types_selected')) { } } unless ($noreserves) { + $template->param(TYPES => \@types_old); $template->param(select_item_types => 1); } } + # check that you can actually make the reserve. # $template->param(BIBLIOITEMS => \@data); -- 2.39.5