*** empty log message ***
[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 use C4::Interface::CGI::Output;
13 use HTML::Template;
14
15 my $query = new CGI;
16 my ($template, $borrowernumber, $cookie)
17     = get_template_and_user({template_name => "opac-account.tmpl",
18                              query => $query,
19                              type => "opac",
20                              authnotrequired => 0,
21                              flagsrequired => {borrow => 1},
22                              debug => 1,
23                              });
24
25 # get borrower information ....
26 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
27
28 my @bordat;
29 $bordat[0] = $borr;
30
31 $template->param( BORROWER_INFO => \@bordat );
32
33
34 #get account details
35 my ($numaccts,$accts,$total) = getboracctrecord(undef,$borr);
36
37 for (my $i=0;$i<$numaccts;$i++){
38     $accts->[$i]{'amount'}+=0.00;
39     $accts->[$i]{'amountoutstanding'}+=0.00;
40     if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
41         $accts->[$i]{'print_title'};
42     }
43 }
44
45 # add the row parity
46 my $num = 0;
47 foreach my $row (@$accts) {
48     $row->{'even'} = 1 if $num % 2 == 0;
49     $row->{'odd'} = 1 if $num % 2 == 1;
50     $num++;
51 }
52
53
54 $template->param( ACCOUNT_LINES => $accts );
55
56 $template->param( total => $total );
57
58 #$template->param(loggeninuser => $loggedinuser);
59 output_html_with_http_headers $query, $cookie, $template->output;
60