From bb798ae2c054d5d445e5c9f65215a0f255d13b6a Mon Sep 17 00:00:00 2001 From: koha user Date: Tue, 15 Jun 2010 14:04:13 +0200 Subject: [PATCH] MT3753: Fix limits when itemcallnumbers are numbers --- reports/catalogue_stats.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl index f3b92b3029..a98d1078a1 100755 --- a/reports/catalogue_stats.pl +++ b/reports/catalogue_stats.pl @@ -292,8 +292,8 @@ if($barcodefilter){ $strsth .= "select distinctrow $linefield from biblioitems left join items on (items.biblioitemnumber = biblioitems.biblioitemnumber) where barcode $not LIKE ? AND $line is not null "; if ( @linefilter ) { if ($linefilter[1]){ - $strsth .= " and $line >= ? " ; - $strsth .= " and $line <= ? " ; + $strsth .= $linefilter[0] =~ /^\d+$/ ? " and $line >= CAST('?' AS UNSIGNED) " : " and $line >= ? " ; + $strsth .= $linefilter[1] =~ /^\d+$/ ? " and $line <= CAST('?' AS UNSIGNED) " : " and $line <= ? " ; } elsif ($linefilter[0]) { $linefilter[0] =~ s/\*/%/g; $strsth .= " and $line LIKE ? " ; @@ -402,12 +402,12 @@ if($barcodefilter){ } if (@$filters[4]){ @$filters[4]=~ s/\*/%/g ; - $strcalc .= " AND items.itemcallnumber >=" . $dbh->quote(@$filters[4]); + $strcalc .= @$filters[4] =~ /^\d+$/ ? " AND items.itemcallnumber >= CAST(" . $dbh->quote(@$filters[4]) . " AS UNSIGNED)" : " AND items.itemcallnumber >= " . $dbh->quote(@$filters[4]); } if (@$filters[5]){ @$filters[5]=~ s/\*/%/g; - $strcalc .= " AND items.itemcallnumber <=" . $dbh->quote(@$filters[5]); + $strcalc .= @$filters[5] =~ /^\d+$/ ? " AND items.itemcallnumber <= CAST(" . $dbh->quote(@$filters[5]) . " AS UNSIGNED)" : " AND items.itemcallnumber <= " . $dbh->quote(@$filters[5]); } if (@$filters[6]){ -- 2.39.5