From e59722ad7944d14fef376c798841622b090e1f95 Mon Sep 17 00:00:00 2001 From: finlayt Date: Wed, 27 Nov 2002 20:55:35 +0000 Subject: [PATCH] added opac-membership.pl and working on opac-reserve.pl --- opac/opac-membership.pl | 18 ++++++++++++++++++ opac/opac-reserve.pl | 34 +++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 opac/opac-membership.pl diff --git a/opac/opac-membership.pl b/opac/opac-membership.pl new file mode 100644 index 0000000000..220df6361c --- /dev/null +++ b/opac/opac-membership.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl +use strict; +require Exporter; +use CGI; + +use C4::Auth; # get_template_and_user + +my $query = new CGI; + +my ($template, $borrowernumber, $cookie) + = get_template_and_user({template_name => "opac-membership.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + flagsrequired => {borrow => 1}, + }); + +print $query->header(-cookie => $cookie), $template->output; diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 81e58482a3..1236b33e9d 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -4,7 +4,6 @@ require Exporter; use CGI; use C4::Search; -use C4::Output; # gettemplate use C4::Auth; # checkauth, getborrowernumber. use C4::Koha; use C4::Circulation::Circ2; @@ -14,18 +13,16 @@ my $MAXIMUM_NUMBER_OF_RESERVES = 5; my $query = new CGI; - - -my $flagsrequired; -$flagsrequired->{borrow}=1; - -my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired); - - -my $template = gettemplate("opac-reserve.tmpl", "opac"); +my ($template, $borrowernumber, $cookie) + = get_template_and_user({template_name => "opac-reserve.tmpl", + query => $query, + type => "opac", + authnotrequired => 0, + flagsrequired => {borrow => 1}, + debug => 1, + }); # get borrower information .... -my $borrowernumber = getborrowernumber($loggedinuser); my ($borr, $flags) = getpatroninformation(undef, $borrowernumber); my @bordat; $bordat[0] = $borr; @@ -40,6 +37,8 @@ $template->param($bibdata); # get the rank number.... my ($rank,$reserves) = FindReserves($biblionumber); +$template->param(reservecount => $rank); + foreach my $res (@$reserves) { if ($res->{'found'} eq 'W') { $rank--; @@ -60,6 +59,7 @@ $template->param(branchname => $branches->{$branch}->{'branchname'}); # make branch selection options... my $branchoptions = ''; +my @branches; foreach my $br (keys %$branches) { (next) unless $branches->{$br}->{'IS'}; my $selected = ""; @@ -67,14 +67,20 @@ foreach my $br (keys %$branches) { $selected = "selected"; } $branchoptions .= "\n"; + push @branches, {branchcode => $br, branchname => $branches->{$br}->{'branchname'}, selected => $selected}; } $template->param( branchoptions => $branchoptions); +$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, '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; @@ -85,6 +91,8 @@ foreach my $itm (@items) { } } +$template->param(ITEMS => \@items); + foreach my $type (values %types) { my $copies = ""; foreach my $bc (keys %{$type->{'branchinfo'}}) { @@ -181,5 +189,5 @@ if ($query->param('item_types_selected')) { } -$template->param(loggedinuser => $loggedinuser); -print "Content-Type: text/html\n\n", $template->output; + +print $query->header(-cookie => $cookie), $template->output; -- 2.39.5