Fix for 1654
[koha_fer] / members / member.pl
index 99e8340..f24e160 100755 (executable)
@@ -1,8 +1,7 @@
 #!/usr/bin/perl
 
-# $Id$
 
-#script to do a borrower enquiery/brin up borrower details etc
+#script to do a borrower enquiry/bring up borrower details etc
 #written 20/12/99 by chris@katipo.co.nz
 
 
@@ -32,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,13 +82,14 @@ else
 
 
 my @resultsdata;
-my $background = 0;
-for (my $i=0; $i < $count; $i++){
+my $toggle = 0;
+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'});
 
   my %row = (
-    background => $background,
+    toggle => $toggle,
     count => $i+1,
     borrowernumber => $results->[$i]{'borrowernumber'},
     cardnumber => $results->[$i]{'cardnumber'},
@@ -95,8 +98,10 @@ for (my $i=0; $i < $count; $i++){
     categorycode => $results->[$i]{'categorycode'},
     category_type => $results->[$i]{'category_type'},
     category_description => $results->[$i]{'description'},
-    streetaddress => $results->[$i]{'streetaddress'},
+    address => $results->[$i]{'address'},
+       address2 => $results->[$i]{'address2'},
     city => $results->[$i]{'city'},
+       zipcode => $results->[$i]{'zipcode'},
     branchcode => $results->[$i]{'branchcode'},
     overdues => $od,
     issues => $issue,
@@ -106,18 +111,37 @@ for (my $i=0; $i < $count; $i++){
     sort1 => $results->[$i]{'sort1'},
     sort2 => $results->[$i]{'sort2'},
     );
-  if ( $background ) { $background = 0; } else {$background = 1; }
+  if ( $toggle ) { $toggle = 0; } else {$toggle = 1; }
   push(@resultsdata, \%row);
 }
+my $base_url =
+    'member.pl?&amp;'
+  . join(
+    '&amp;',
+    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",
         member          => $member,
         numresults      => $count,
         resultsloop     => \@resultsdata,
-        intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
-        intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-        IntranetNav => C4::Context->preference("IntranetNav"),
             );
 
 output_html_with_http_headers $input, $cookie, $template->output;