From 7f2d6b025f73a621fd0cb6727c1cb4bf74e7f61a Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 12 Dec 2007 15:34:36 +0100 Subject: [PATCH] Bug FIX : 437 'Browse Members' function should return paged results Adding pagination_bar to results if needed. Signed-off-by: Joshua Ferraro --- .../prog/en/modules/members/member.tmpl | 4 ++- members/member.pl | 28 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl index 426fe20b07..8ece441bc4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl @@ -50,8 +50,10 @@

Results for Search:

-
patrons found
+
patrons found
+ Page : Results to
+

diff --git a/members/member.pl b/members/member.pl index 530e2fe0ac..f24e160f1b 100755 --- a/members/member.pl +++ b/members/member.pl @@ -31,6 +31,9 @@ use C4::Members; my $input = new CGI; my $quicksearch = $input->param('quicksearch'); +my $startfrom = $input->param('startfrom')||1; +my $resultsperpage = $input->param('resultsperpage')||10; + my ($template, $loggedinuser, $cookie); if($quicksearch){ ($template, $loggedinuser, $cookie) @@ -80,7 +83,8 @@ else my @resultsdata; my $toggle = 0; -for (my $i=0; $i < $count; $i++){ +my $to=($count>($startfrom*$resultsperpage)?$startfrom*$resultsperpage:$count); +for (my $i=($startfrom-1)*$resultsperpage; $i < $to; $i++){ #find out stats my ($od,$issue,$fines)=GetMemberIssuesAndFines($results->[$i]{'borrowernumber'}); @@ -110,6 +114,28 @@ for (my $i=0; $i < $count; $i++){ if ( $toggle ) { $toggle = 0; } else {$toggle = 1; } push(@resultsdata, \%row); } +my $base_url = + 'member.pl?&' + . join( + '&', + map { $_->{term} . '=' . $_->{val} } ( + { term => 'member', val => $member}, + { term => 'orderby', val => $orderby }, + { term => 'resultsperpage', val => $resultsperpage }, + { term => 'type', val => 'intranet' }, + ) + ); + +$template->param( + paginationbar => pagination_bar( + $base_url, int( $count / $resultsperpage ) + 1, + $startfrom, 'startfrom' + ), + startfrom => $startfrom, + from => ($startfrom-1)*$resultsperpage+1, + to => $to, + multipage => ($count != $to || $startfrom!=1), +); $template->param( searching => "1", -- 2.39.5
&orderby=cardnumber">Card