From 7af64ff7bd26eaa0d8cdb688f0db1526e438f087 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 6 Jan 2014 16:16:22 +0000 Subject: [PATCH] Bug 11336: (follow-up) fix typo in previous follow-up This patch corrects a typo that broken ModReserveFill(). This patch also adds a unit test that (via two levels of indirection) exercises ModReserveFill(). Signed-off-by: Galen Charlton --- C4/Reserves.pm | 2 +- t/db_dependent/Circulation.t | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index de254885ea..689f34d4e8 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1181,7 +1181,7 @@ sub ModReserveFill { # now fix the priority on the others (if the priority wasn't # already sorted!).... unless ( $priority == 0 ) { - FixPriority({ reserve_id => $reserve_id }); + _FixPriority({ reserve_id => $reserve_id }); } } diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index aa2a969da9..73c0bf36b5 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -9,7 +9,7 @@ use C4::Items; use C4::Members; use C4::Reserves; -use Test::More tests => 44; +use Test::More tests => 45; BEGIN { use_ok('C4::Circulation'); @@ -201,6 +201,17 @@ C4::Context->dbh->do("DELETE FROM accountlines"); $biblionumber ); + my $barcode3 = 'R00000346'; + my ( $item_bibnum3, $item_bibitemnum3, $itemnumber3 ) = AddItem( + { + homebranch => $branch, + holdingbranch => $branch, + barcode => $barcode3, + replacementprice => 23.00 + }, + $biblionumber + ); + # Create 2 borrowers my %renewing_borrower_data = ( firstname => 'John', @@ -259,8 +270,14 @@ C4::Context->dbh->do("DELETE FROM accountlines"); is( $error, 'on_reserve', '(Bug 10663) Cannot renew, reserved (returned error is on_reserve)'); my $reserveid = C4::Reserves::GetReserveId({ biblionumber => $biblionumber, borrowernumber => $reserving_borrowernumber}); - CancelReserve({ reserve_id => $reserveid }); - + my $reserving_borrower = GetMember( borrowernumber => $reserving_borrowernumber ); + AddIssue($reserving_borrower, $barcode3); + my $reserve = $dbh->selectrow_hashref( + 'SELECT * FROM old_reserves WHERE reserve_id = ?', + { Slice => {} }, + $reserveid + ); + is($reserve->{found}, 'F', 'hold marked completed when checking out item that fills it'); diag("Item-level hold, renewal test"); AddReserve( -- 2.39.5