road to 1.3.2 :
[koha.git] / opac / opac-account.pl
1 #!/usr/bin/perl
2
3 # wrriten 15/10/2002 by finlay@katipo.oc.nz
4 # script to display borrowers account details in the opac
5
6 use strict;
7 use C4::Output;
8 use CGI;
9 use C4::Search;
10 use C4::Circulation::Circ2;
11 use C4::Auth;
12
13 my $query = new CGI;
14
15 my $flagsrequired;
16 $flagsrequired->{borrow}=1;
17
18 my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
19
20 my $template = gettemplate("opac-account.tmpl", "opac");
21
22 # get borrower information ....
23 my $borrowernumber = getborrowernumber($loggedinuser);
24 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
25
26 my @bordat;
27 $bordat[0] = $borr;
28
29 $template->param( BORROWER_INFO => \@bordat );
30
31
32 #get account details
33 my ($numaccts,$accts,$total) = getboracctrecord(undef,$borr);   
34
35 for (my $i=0;$i<$numaccts;$i++){
36     $accts->[$i]{'amount'}+=0.00;
37     $accts->[$i]{'amountoutstanding'}+=0.00;
38     if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
39         $accts->[$i]{'print_title'};
40     }
41 }
42
43 $template->param( ACCOUNT_LINES => $accts );
44
45 $template->param( total => $total );
46
47 $template->param( loggedinuser => $loggedinuser );
48 print "Content-Type: text/html\n\n", $template->output;