From 36f2a5cb784de60c8923b50199ed10a28968f0c9 Mon Sep 17 00:00:00 2001 From: finlayt Date: Tue, 1 Oct 2002 07:11:12 +0000 Subject: [PATCH] This is a first draft of this script. It presents borrowers information to themselves. It uses the template opac-user.tmpl --- opac/opac-user.pl | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 opac/opac-user.pl diff --git a/opac/opac-user.pl b/opac/opac-user.pl new file mode 100755 index 0000000000..19484a5e2f --- /dev/null +++ b/opac/opac-user.pl @@ -0,0 +1,62 @@ +#!/usr/bin/perl +use strict; +require Exporter; +use CGI; + +use C4::Search; # borrdata +use C4::Output; # gettemplate +use C4::Auth; # checkauth, getborrowernumber. +use C4::Koha; +use C4::Circulation::Circ2; +use C4::Reserves2; + +my $query = new CGI; + +my ($loggedinuser, $cookie, $sessionID) = checkauth($query); + +my $template = gettemplate("opac-user.tmpl", "opac"); + +# get borrower information .... +my $borrowernumber = getborrowernumber($loggedinuser); +my ($borr, $flags) = getpatroninformation(undef, $borrowernumber); + +$borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'}); +$borr->{'expiry'} = slashifyDate($borr->{'expiry'}); +$borr->{'dateofbirth'} = slashifyDate($borr->{'dateofbirth'}); +$borr->{'ethnicity'} = fixEthnicity($borr->{'ethnicity'}); + +my @bordat; +$bordat[0] = $borr; + +$template->param(BORROWER_INFO => \@bordat); + +#get issued items .... +my $issues = getissues($borr); + +my $count=0; +my @issuedat; +foreach my $key (keys %$issues) { + my $issue = $issues->{$key}; + $issue->{'date_due'} = slashifyDate($issue->{'date_due'}); + if ($issue->{'overdue'}) { + $issue->{'status'} = "OVERDUE"; + } else { + $issue->{'status'} = "Issued"; + } +# check for reserves + my ($restype, $res) = CheckReserves($issue->{'itemnumber'}); + if ($restype) { + $issue->{'status'} .= "Reserved"; + } + my ($charges, $itemtype) = calc_charges(undef, undef, $issue->{'itemnumber'}, $borrowernumber); + $issue->{'charges'} = $charges; + push @issuedat, $issue; + $count++; +} + +$template->param(ISSUES => \@issuedat); +$template->param(issues_count => $count); + + + +print "Content-Type: text/html\n\n", $template->output; -- 2.39.5