[Koha-patches] [PATCH] Adding the capacity to retrieve patron reading records by cardnumber

chris.nighswonger at gmail.com chris.nighswonger at gmail.com
Thu Nov 19 05:09:39 CET 2009


From: Chris Nighswonger <chris.nighswonger at gmail.com>

This patch adds a 'cardnumber' parameter and checks to see if it is present when the
script is called. If it is, the patron information is retrieved and borrowernumber set
from that. Otherwise, the patron information is retrieved by borrowernumber.

The changes in this patch do not require porting to any other Koha code.

Sponsored by www.digital-loom.com
---
 members/readingrec.pl |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/members/readingrec.pl b/members/readingrec.pl
index ce3fb37..b93eec1 100755
--- a/members/readingrec.pl
+++ b/members/readingrec.pl
@@ -23,21 +23,33 @@
 use strict;
 use warnings;

+use CGI;
+
 use C4::Auth;
 use C4::Output;
-use CGI;
 use C4::Members;
 use C4::Branch;
-
 use C4::Dates qw/format_date/;
-my $input=new CGI;

+my $input = CGI->new;

-my $borrowernumber=$input->param('borrowernumber');
 #get borrower details
-my $data=GetMember($borrowernumber,'borrowernumber');
-my $order=$input->param('order') || '';
-my $order2=$order;
+my $data = undef;
+my $borrowernumber = undef;
+my $cardnumber = undef;
+
+if ($input->param('cardnumber')) {
+    $cardnumber = $input->param('cardnumber');
+    $data = GetMember($cardnumber,'cardnumber');
+    $borrowernumber = $data->{'borrowernumber'}; # we must define this as it is used to retrieve other data about the patron
+}
+if ($input->param('borrowernumber')) {
+    $borrowernumber = $input->param('borrowernumber');
+    $data = GetMember($borrowernumber,'borrowernumber');
+}
+
+my $order = $input->param('order') || '';
+my $order2 = $order;
 if ($order2 eq ''){
   $order2="date_due desc";
 }
@@ -47,7 +59,7 @@ if ($limit){
     if ($limit eq 'full'){
 		$limit=0;
     }
-}
+}
 else {
   $limit=50;
 }
@@ -86,8 +98,8 @@ if ( $data->{'category_type'} eq 'C') {
 }

 $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
-if (! $limit){
-	$limit = 'full';
+if (! $limit){
+	$limit = 'full';
 }

 my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
@@ -117,7 +129,7 @@ $template->param(
 			   			branchcode => $data->{'branchcode'},
 			   			is_child        => ($data->{'category_type'} eq 'C'),
 			   			branchname => GetBranchName($data->{'branchcode'}),
-						showfulllink => ($count > 50),
+						showfulllink => ($count > 50),
 						loop_reading => \@loop_reading);
 output_html_with_http_headers $input, $cookie, $template->output;

--
1.6.0.4




More information about the Koha-patches mailing list