From b558a13323f8367c1474567e8cdc7e9be46528ba Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 1 Apr 2008 12:01:03 -0500 Subject: [PATCH] disallow division by zero in hold ratio report Signed-off-by: Joshua Ferraro --- circ/reserveratios.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl index 2ec48ebae8..b45bab0985 100755 --- a/circ/reserveratios.pl +++ b/circ/reserveratios.pl @@ -90,9 +90,12 @@ if (!defined($startdate) or $startdate eq "") { if (!defined($enddate) or $enddate eq "") { $enddate = format_date($todaysdate); } -if (!defined($ratio) or $ratio eq "") { +if (!defined($ratio) or $ratio eq "" or $ratio !~ /^\s*\d+\s*$/ ) { $ratio = 3; } +if ($ratio == 0) { + $ratio = 1; # prevent division by zero +} my $dbh = C4::Context->dbh; my ($sqlorderby, $sqldatewhere) = ("",""); -- 2.20.1