Bug 6100: request.pl should check maxreserves exists
authorJared Camins-Esakov <jcamins@bywatersolutions.com>
Wed, 6 Apr 2011 18:00:47 +0000 (14:00 -0400)
committerChris Cormack <chrisc@catalyst.net.nz>
Thu, 7 Apr 2011 02:00:11 +0000 (14:00 +1200)
Adds a check to confirm that the maxreserves syspref actually has a value before
using it. Also fixes an off-by-one error in the maxreserves calculation that
would allow librarians to place maxreserves + 1 holds for patrons.

Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
reserve/request.pl

index a047f4d..6579c3d 100755 (executable)
@@ -143,7 +143,7 @@ if ($cardnumber) {
     my $number_reserves =
       GetReserveCount( $borrowerinfo->{'borrowernumber'} );
 
-    if ( $number_reserves > C4::Context->preference('maxreserves') ) {
+    if ( C4::Context->preference('maxreserves') && $number_reserves >= C4::Context->preference('maxreserves') ) {
                $warnings = 1;
         $maxreserves = 1;
     }