Bugzilla – Attachment 2247 Details for
Bug 4892
Make the accounts page page, so that the list of records doesn't end up being huge.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-The-accounts-page-is-now-paged.patch (text/plain), 4.70 KB, created by
Robin Sheat
on 2010-06-15 04:58:27 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Robin Sheat
Created:
2010-06-15 04:58:27 UTC
Size:
4.70 KB
patch
obsolete
>From 4a41afac4a37922a3f813259d93bca5c4ca4dd78 Mon Sep 17 00:00:00 2001 >From: Robin Sheat <robin@catalyst.net.nz> >Date: Tue, 15 Jun 2010 16:30:25 +1200 >Subject: [PATCH] The accounts page is now paged > >This prevents you getting a huge screen full of records. >--- > .../prog/en/modules/members/boraccount.tmpl | 7 +++ > members/boraccount.pl | 45 +++++++++++++++++-- > 2 files changed, 47 insertions(+), 5 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 fce5a4d..7b64602 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl >@@ -64,6 +64,13 @@ > </tr> > </tfoot> > </table> >+<!-- TMPL_IF NAME="show_back_link" --> >+<a href="boraccount.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&first=<!-- TMPL_VAR NAME="back_first_record" -->"><< Newer</a> >+<!-- /TMPL_IF --> >+ Showing <!-- TMPL_VAR NAME="current_start" --> to <!-- TMPL_VAR NAME="current_last" --> of <!-- TMPL_VAR NAME="account_count" --> >+<!-- TMPL_IF NAME="show_forward_link" --> >+<a href="boraccount.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&first=<!-- TMPL_VAR NAME="forward_first_record" -->">Older >></a> >+<!-- /TMPL_IF --> > </div></div> > > </div> >diff --git a/members/boraccount.pl b/members/boraccount.pl >index 5509f3d..6bb69a6 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -48,6 +48,11 @@ my ($template, $loggedinuser, $cookie) > my $borrowernumber=$input->param('borrowernumber'); > my $action = $input->param('action') || ''; > >+# The index of the first record to display >+my $first_record = $input->param('first') || 0; >+# The number of records to show >+my $count_record = $input->param('count') || 20; >+ > #get borrower details > my $data=GetMember('borrowernumber' => $borrowernumber); > >@@ -63,14 +68,36 @@ if ( $data->{'category_type'} eq 'C') { > } > > #get account details >-my ($total,$accts,undef)=GetMemberAccountRecords($borrowernumber); >+my ($total,$accts,$num_records)=GetMemberAccountRecords($borrowernumber); > my $totalcredit; > if($total <= 0){ > $totalcredit = 1; > } > >+# Validate the actual boundaries we need, if they're outside a useful range, >+# just reset them to something we understand. >+$first_record = 0 if ($first_record < 0 || $first_record >= @$accts); >+$count_record = 20 if ($count_record < 0); >+my $last_record = $first_record+$count_record-1; >+$last_record = @$accts - 1 if ($last_record >= @$accts); >+ >+# Take an array slice >+my @accts = @$accts[$first_record .. $last_record]; >+ >+my ($show_back_link, $back_first_record) = (0, undef); >+if ($first_record > 0) { >+ $show_back_link = 1; >+ $back_first_record = $first_record-$count_record; >+ $back_first_record = 0 if ($back_first_record < 0); >+} >+my ($show_forward_link, $forward_first_record) = (0, undef); >+if (@$accts > $first_record+$count_record) { >+ $show_forward_link = 1; >+ $forward_first_record = $first_record+$count_record; >+} >+ > my $reverse_col = 0; # Flag whether we need to show the reverse column >-foreach my $accountline ( @{$accts}) { >+foreach my $accountline (@accts) { > $accountline->{amount} += 0.00; > if ($accountline->{amount} <= 0 ) { > $accountline->{amountcredit} = 1; >@@ -105,7 +132,7 @@ $template->param( > cardnumber => $data->{'cardnumber'}, > categorycode => $data->{'categorycode'}, > category_type => $data->{'category_type'}, >- categoryname => $data->{'description'}, >+ categoryname => $data->{'description'}, > address => $data->{'address'}, > address2 => $data->{'address2'}, > city => $data->{'city'}, >@@ -114,11 +141,19 @@ $template->param( > phone => $data->{'phone'}, > email => $data->{'email'}, > branchcode => $data->{'branchcode'}, >- branchname => GetBranchName($data->{'branchcode'}), >+ branchname => GetBranchName($data->{'branchcode'}), > total => sprintf("%.2f",$total), > totalcredit => $totalcredit, > is_child => ($data->{'category_type'} eq 'C'), > reverse_col => $reverse_col, >- accounts => $accts ); >+ accounts => [ @accts ], >+ account_count => $num_records, >+ show_back_link => $show_back_link, >+ show_forward_link => $show_forward_link, >+ back_first_record => $back_first_record, >+ forward_first_record=> $forward_first_record, >+ current_start => ($first_record+1), >+ current_last => ($last_record+1), >+); > > output_html_with_http_headers $input, $cookie, $template->output; >-- >1.7.0.4 >
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 4892
: 2247