[Koha-patches] [PATCH] Enhancement: This patch adds a 'cardnumber' parameter and checks

Chris Nighswonger chris.nighswonger at gmail.com
Wed Jan 27 03:32:05 CET 2010


From: Chris Nighswonger <cnighswonger at foundations.edu>

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 |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/members/readingrec.pl b/members/readingrec.pl
index b2d1d15..714e77a 100755
--- a/members/readingrec.pl
+++ b/members/readingrec.pl
@@ -23,19 +23,31 @@
 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 $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 ''){
@@ -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