From cd8802b7091c94a88098f64506af261b4d284162 Mon Sep 17 00:00:00 2001 From: Liz Rea 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