Bug 15422: Consider partial copies needed as whole numbers
authorNick Clemens <nick@bywatersolutions.com>
Tue, 4 Dec 2018 14:58:35 +0000 (14:58 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 8 Oct 2019 13:08:43 +0000 (14:08 +0100)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

circ/reserveratios.pl

index 1beb559..b4b0b81 100755 (executable)
@@ -22,6 +22,7 @@ use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use Date::Calc qw/Today Add_Delta_YM/;
+use POSIX qw( ceil );
 
 use C4::Context;
 use C4::Output;
@@ -154,7 +155,7 @@ $sth->execute(@query_params);
 my @reservedata;
 while ( my $data = $sth->fetchrow_hashref ) {
     my $thisratio = $data->{reservecount} / $data->{itemcount};
-    my $ratiocalc = $data->{reservecount}/$ratio - $data->{itemcount};
+    my $ratiocalc = ceil($data->{reservecount}/$ratio - $data->{itemcount});
     $ratiocalc >= 1 or next;  # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
     push(
         @reservedata,