[Koha-patches] [SIGNED OFF] Bug 5484 - Handling bad borrower categories in serial routing lists more gracefully

Colin Campbell colin.campbell at ptfs-europe.com
Mon Dec 13 12:44:35 CET 2010


From: Chris Cormack <chrisc at catalyst.net.nz>


Signed-off-by: Colin Campbell <colin.campbell at ptfs-europe.com>
---
 serials/member-search.pl |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/serials/member-search.pl b/serials/member-search.pl
index f18c2f3..f027df5 100755
--- a/serials/member-search.pl
+++ b/serials/member-search.pl
@@ -1,5 +1,7 @@
 #!/usr/bin/perl
 
+# Parts copyright Catalyst IT 2010
+#
 # This file is part of Koha.
 #
 # Koha is free software; you can redistribute it and/or modify it under the
@@ -110,18 +112,20 @@ my @resultsdata;
 $to=($count>$to?$to:$count);
 my $index=$from;
 foreach my $borrower(@$results[$from..$to-1]){
-  #find out stats
-
-  $$borrower{'dateexpiry'}= C4::Dates->new($$borrower{'dateexpiry'},'iso')->output('syspref');
-
-  my %row = (
-    count => $index++,
-	%$borrower,
-	%{$categories_dislay{$$borrower{categorycode}}},
-    );
-  push(@resultsdata, \%row);
+    # find out stats
+    $borrower->{'dateexpiry'}= C4::Dates->new($borrower->{'dateexpiry'},'iso')->output('syspref');
+    if ($categories_dislay{$borrower->{'categorycode'}}){
+        my %row = (
+	    count => $index++,
+	    %$borrower,
+	    %{$categories_dislay{$$borrower{categorycode}}},
+	);
+	push(@resultsdata, \%row);
+    }
+    else {
+	 warn $borrower->{'cardnumber'} ." has a bad category code of " . $borrower->{'categorycode'} ."\n";
+    }
 }
-
 if ($$patron{branchcode}){
 	foreach my $branch (grep{$_->{value} eq $$patron{branchcode}}@$branches){
 		$$branch{selected}=1;
-- 
1.7.3.3



More information about the Koha-patches mailing list