[Patches] [PATCH] Bug 7157 - followup - error catching for nonexistent categories.

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Wed Dec 21 03:10:30 NZDT 2011


From: Liz Rea <wizzyrea at gmail.com>
Date: Tue, 13 Dec 2011 11:26:48 -0600
Subject: [PATCH] Bug 7157 - followup - error catching for nonexistent categories.
Content-Type: text/plain; charset="utf-8"

This applies on top of the original patch - may not be the best implementation ever, suggestions are welcome.
---
 misc/cronjobs/j2a.pl |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/misc/cronjobs/j2a.pl b/misc/cronjobs/j2a.pl
index b445b10..c0db179 100644
--- a/misc/cronjobs/j2a.pl
+++ b/misc/cronjobs/j2a.pl
@@ -142,7 +142,15 @@ $sth->execute( $fromcat )
 my $agelimit = $sth->fetchrow_array();
 if ( not $agelimit ) {
 
-	die "No patron category with that category code. Please try again. \n";
+	die "No patron category $fromcat. Please try again. \n";
+}
+$query=qq|SELECT categorycode from categories where categorycode=?|;
+$sth=$dbh->prepare( $query );
+$sth->execute( $tocat )
+	or die "Couldn't execute statement: " . $sth->errstr;
+my $tocatage = $sth->fetchrow_array();
+if ( not $tocatage ){
+	die "No patron category $tocat. Please try again. \n";
 }
 $sth->finish(  );
 $year -=$agelimit;
-- 
1.7.2.5


More information about the Patches mailing list