Bugzilla – Attachment 914 Details for
Bug 2889
templates should not use [% IF ( loop.odd ) %]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for boraccount.pl
0001-Bug-2889-Remove-toggle-in-boraccount-display.patch (text/plain), 6.22 KB, created by
Chris Cormack
on 2010-03-26 16:53:00 UTC
(
hide
)
Description:
Patch for boraccount.pl
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2010-03-26 16:53:00 UTC
Size:
6.22 KB
patch
obsolete
>From eaa85677ccaa74b1da66bfd55af4cc783a8a778b Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Fri, 26 Mar 2010 16:33:20 +0000 >Subject: [PATCH] Bug 2889 Remove toggle in boraccount display >Content-Type: text/plain; charset="utf-8" > >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 >--- > .../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 8f649ad..fce5a4d 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 @@ > <th>Description of charges</th> > <th>Amount</th> > <th>Outstanding</th> >+ <!-- TMPL_IF NAME="reverse_col" --> > <th> </th> >+ <!-- /TMPL_IF --> > </tr> > > <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed --> > <!-- TMPL_LOOP NAME="accounts" --> > >- <!-- TMPL_IF NAME="toggle" --> <tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF --> >+ <!-- TMPL_IF NAME="__odd__" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF --> > <td><!-- TMPL_VAR NAME="date" --></td> > <td><!-- TMPL_VAR NAME="description" --> <!-- TMPL_IF NAME="itemnumber" --><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->">View item</a> <!-- /TMPL_IF --><!-- TMPL_IF NAME="printtitle" --> <!-- TMPL_VAR NAME="title" escape="html" --><!-- /TMPL_IF --></td> > <!-- TMPL_IF NAME="amountcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amount" --></td> > <!-- TMPL_IF NAME="amountoutstandingcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amountoutstanding" --></td> >+ <!-- TMPL_IF NAME="reverse_col" --> > <td> > <!-- TMPL_IF NAME="payment" --> > <a href="boraccount.pl?action=reverse&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&accountno=<!-- TMPL_VAR NAME="accountno" -->">Reverse</a> >@@ -50,6 +53,7 @@ > > <!-- /TMPL_IF --> > </td> >+ <!-- /TMPL_IF --> > </tr> > > <!-- /TMPL_LOOP --> >diff --git a/members/boraccount.pl b/members/boraccount.pl >index 90986ea..5509f3d 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; >-- >1.6.6.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 2889
:
911
|
912
|
913
|
914
|
2157
|
2306
|
2307
|
30071
|
30790
|
31834
|
31858
|
31859
|
31866
|
31867