[Koha-patches] [PATCH] disallow division by zero in hold ratio report
Galen Charlton
galen.charlton at liblime.com
Tue Apr 1 19:01:03 CEST 2008
---
circ/reserveratios.pl | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl
index 2ec48eb..b45bab0 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) = ("","");
--
1.5.5.rc0.16.g02b00
More information about the Koha-patches
mailing list