Fixing reference to CheckReserves (script was pointing to Circ2.pm instead of Reserves2)
[koha.git] / opac / opac-account.pl
index 94fc308..3216281 100755 (executable)
@@ -9,18 +9,21 @@ use CGI;
 use C4::Search;
 use C4::Circulation::Circ2;
 use C4::Auth;
+use C4::Interface::CGI::Output;
+use HTML::Template;
+use C4::Date;
 
 my $query = new CGI;
-
-my $flagsrequired;
-$flagsrequired->{borrow}=1;
-
-my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
-
-my $template = gettemplate("opac-account.tmpl", "opac");
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "opac-account.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;
@@ -30,7 +33,7 @@ $template->param( BORROWER_INFO => \@bordat );
 
 
 #get account details
-my ($numaccts,$accts,$total) = getboracctrecord(undef,$borr);   
+my ($numaccts,$accts,$total) = getboracctrecord(undef,$borr);
 
 for (my $i=0;$i<$numaccts;$i++){
     $accts->[$i]{'amount'}+=0.00;
@@ -40,9 +43,21 @@ for (my $i=0;$i<$numaccts;$i++){
     }
 }
 
-$template->param( ACCOUNT_LINES => $accts );
+# add the row parity
+my $num = 0;
+foreach my $row (@$accts) {
+    $row->{'even'} = 1 if $num % 2 == 0;
+    $row->{'odd'} = 1 if $num % 2 == 1;
+    $num++;
+}
+
+
+$template->param( ACCOUNT_LINES => $accts,
+                            LibraryName => C4::Context->preference("LibraryName"),
+ );
 
 $template->param( total => $total );
 
-$template->param( loggedinuser => $loggedinuser );
-print "Content-Type: text/html\n\n", $template->output; 
+#$template->param(loggeninuser => $loggedinuser);
+output_html_with_http_headers $query, $cookie, $template->output;
+