From cb031bace9c9046bd387f2f6c18cf1a26178b040 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Fri, 26 Mar 2010 16:41:28 +0000 Subject: [PATCH] Bug 2889 Remove toggle in boraccount display Also remove the reverse column if no contents to be displayed ( otherwise looks like a markup error ) Rationalize the main loop now toggle not required Signed-off-by: Galen Charlton --- .../prog/en/modules/members/boraccount.tmpl | 6 +- members/boraccount.pl | 60 +++++++------------ 2 files changed, 27 insertions(+), 39 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl index 8f649ade11..fce5a4d226 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl @@ -32,17 +32,20 @@ Description of charges Amount Outstanding +   + - +  &itemnumber=">View item  + &accountno=">Reverse @@ -50,6 +53,7 @@   + diff --git a/members/boraccount.pl b/members/boraccount.pl index 90986ea7a6..5509f3db77 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -63,49 +63,33 @@ if ( $data->{'category_type'} eq 'C') { } #get account details -my ($total,$accts,$numaccts)=GetMemberAccountRecords($borrowernumber); +my ($total,$accts,undef)=GetMemberAccountRecords($borrowernumber); my $totalcredit; if($total <= 0){ $totalcredit = 1; } -my @accountrows; # this is for the tmpl-loop - -my $toggle; -for (my $i=0;$i<$numaccts;$i++){ - if($i%2){ - $toggle = 0; - } else { - $toggle = 1; + +my $reverse_col = 0; # Flag whether we need to show the reverse column +foreach my $accountline ( @{$accts}) { + $accountline->{amount} += 0.00; + if ($accountline->{amount} <= 0 ) { + $accountline->{amountcredit} = 1; } - $accts->[$i]{'toggle'} = $toggle; - $accts->[$i]{'amount'}+=0.00; - if($accts->[$i]{'amount'} <= 0){ - $accts->[$i]{'amountcredit'} = 1; + $accountline->{amountoutstanding} += 0.00; + if ( $accountline->{amountoutstanding} <= 0 ) { + $accountline->{amountoutstandingcredit} = 1; } - $accts->[$i]{'amountoutstanding'}+=0.00; - if($accts->[$i]{'amountoutstanding'} <= 0){ - $accts->[$i]{'amountoutstandingcredit'} = 1; + + $accountline->{date} = format_date($accountline->{date}); + $accountline->{amount} = sprintf '%.2f', $accountline->{amount}; + $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding}; + if ($accountline->{accounttype} eq 'Pay') { + $accountline->{payment} = 1; + $reverse_col = 1; } - my %row = ( 'date' => format_date($accts->[$i]{'date'}), - 'amountcredit' => $accts->[$i]{'amountcredit'}, - 'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'}, - 'toggle' => $accts->[$i]{'toggle'}, - 'description' => $accts->[$i]{'description'}, - 'itemnumber' => $accts->[$i]{'itemnumber'}, - 'biblionumber' => $accts->[$i]{'biblionumber'}, - 'amount' => sprintf("%.2f",$accts->[$i]{'amount'}), - 'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}), - 'accountno' => $accts->[$i]{'accountno'}, - 'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ), - - ); - - if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){ - $row{'printtitle'}=1; - $row{'title'} = $accts->[$i]{'title'}; + if ($accountline->{accounttype} ne 'F' && $accountline->{accounttype} ne 'FU'){ + $accountline->{printtitle} = 1; } - - push(@accountrows, \%row); } $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); @@ -121,7 +105,6 @@ $template->param( cardnumber => $data->{'cardnumber'}, categorycode => $data->{'categorycode'}, category_type => $data->{'category_type'}, - # category_description => $data->{'description'}, categoryname => $data->{'description'}, address => $data->{'address'}, address2 => $data->{'address2'}, @@ -134,7 +117,8 @@ $template->param( branchname => GetBranchName($data->{'branchcode'}), total => sprintf("%.2f",$total), totalcredit => $totalcredit, - is_child => ($data->{'category_type'} eq 'C'), - accounts => \@accountrows ); + is_child => ($data->{'category_type'} eq 'C'), + reverse_col => $reverse_col, + accounts => $accts ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5