[Koha-cvs] CVS: koha/opac opac-user.pl,NONE,1.1.2.1

Finlay Thompson finlayt at users.sourceforge.net
Tue Oct 1 09:11:14 CEST 2002


Update of /cvsroot/koha/koha/opac
In directory usw-pr-cvs1:/tmp/cvs-serv20708

Added Files:
      Tag: rel-1-2
	opac-user.pl 
Log Message:

This is a first draft of this script. It presents borrowers information to themselves.
It uses the template opac-user.tmpl


--- NEW FILE ---
#!/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; 





More information about the Koha-cvs mailing list