disallow division by zero in hold ratio report
authorGalen Charlton <galen.charlton@liblime.com>
Tue, 1 Apr 2008 17:01:03 +0000 (12:01 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 3 Apr 2008 19:42:13 +0000 (14:42 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
circ/reserveratios.pl

index 2ec48eb..b45bab0 100755 (executable)
@@ -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) = ("","");