From 09625956b179ee35abb62591e9534d67fdc93689 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 4 Jun 2014 10:48:02 -0400 Subject: [PATCH] Bug 5144 [2] - Duplicate holds allowed if patron clicks back button after placing hold Koha is currently not engineered to handle multiple holds per record. Until such time that is does, we should not allow them to be created. Test Plan: 1) Apply this patch 2) Log in to the opac 3) Place a hold 4) Hit the back button on your browser 5) Place the hold again 6) Note the new message --- C4/Reserves.pm | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 22a9ecb..e04c3fc 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -154,6 +154,17 @@ sub AddReserve { $constraint, $bibitems, $priority, $resdate, $expdate, $notes, $title, $checkitem, $found ) = @_; + + my ($count) = C4::Context->dbh->selectrow_array( + 'SELECT COUNT(*) FROM reserves WHERE biblionumber = ? AND borrowernumber = ?', + undef, + ( $biblionumber, $borrowernumber ) + ); + if ( $count > 0 ) { + carp("AddReserve: borrower $borrowernumber already has $count holds for biblionumber $biblionumber"); + return; + } + my $fee = GetReserveFee($borrowernumber, $biblionumber, $constraint, $bibitems ); -- 1.7.2.5