Bugzilla – Attachment 27122 Details for
Bug 11947
Hold priorities not re-calculated when hold is confirmed on checkin.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 11947 - renumber reserves when hold is confirmed
PASSED-QA-Bug-11947---renumber-reserves-when-hold-.patch (text/plain), 4.18 KB, created by
Katrin Fischer
on 2014-04-15 09:41:09 UTC
(
hide
)
Description:
[PASSED QA] Bug 11947 - renumber reserves when hold is confirmed
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-04-15 09:41:09 UTC
Size:
4.18 KB
patch
obsolete
>From 493aaed27c92404fe34b69f359eb3fb88729dc50 Mon Sep 17 00:00:00 2001 >From: Robin Sheat <robin@catalyst.net.nz> >Date: Mon, 17 Mar 2014 18:33:00 +1300 >Subject: [PATCH] [PASSED QA] Bug 11947 - renumber reserves when hold is > confirmed > >Currently when a reserve is moved to "waiting" status because it's >acknowledged on checkin, the reserve priorities aren't renumbered. This >causes things to go a bit haywire in the UI, in particular, some >reserves can unjustly end up with priority 1 when they shouldn't. It >also seemed to mess with the logic of who should get it next, but I >didn't look too closely at that. > >This patch forces a renumbering so that all the priorities remain >copacetic. > >Test plan: >* have a few borrowers, say 4. >* have a biblio with a single item (you can scale this up, it should > work just the same.) >* issue the item to borrower A >* have borrowers B, C, and D place a hold on the item >* return the item, acknowledge that it'll be put aside for B. >* view the holds on the item. >Without the patch: >* the hold priorities in the UI end up being "waiting, 2, 1" when they > should be "waiting, 1, 2". >* in the database "reserves" table, they're really "0, 2, 3" when they > should be "0, 1, 2". >With the patch: >* the hold priorities in the UI end up being "waiting, 1, 2" >* in the database, they're "0, 1, 2" > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Test plan confirms that the problem exists and that the patch corrects >it. > >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Passes all tests and QA script, especially t/db_dependent/Reserves.t. >Improves priority calculation. >--- > C4/Reserves.pm | 2 +- > t/db_dependent/Reserves.t | 27 ++++++++++++++++++++++++++- > 2 files changed, 27 insertions(+), 2 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index eb1ae2b..db0a59c 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1296,7 +1296,7 @@ sub ModReserveAffect { > $sth = $dbh->prepare($query); > $sth->execute( $itemnumber, $borrowernumber,$biblionumber); > _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf ); >- >+ _FixPriority( { biblionumber => $biblionumber } ); > if ( C4::Context->preference("ReturnToShelvingCart") ) { > CartToShelf( $itemnumber ); > } >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 4b0058c..adf762b 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 31; >+use Test::More tests => 34; > use MARC::Record; > use DateTime::Duration; > >@@ -15,6 +15,7 @@ use t::lib::Mocks; > > use Koha::DateUtils; > >+use Data::Dumper; > BEGIN { > use_ok('C4::Reserves'); > } >@@ -199,6 +200,30 @@ my ($itemnum_cpl, $itemnum_fpl); > barcode => 'bug10272_FPL' > } , $bibnum2); > >+# Ensure that priorities are numbered correcly when a hold is moved to waiting >+# (bug 11947) >+$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); >+AddReserve('RPL', $requesters{'RPL'}, $bibnum2, >+ $constraint, $bibitems, 1, $resdate, $expdate, $notes, >+ $title, $checkitem, $found); >+AddReserve('FPL', $requesters{'FPL'}, $bibnum2, >+ $constraint, $bibitems, 2, $resdate, $expdate, $notes, >+ $title, $checkitem, $found); >+AddReserve('CPL', $requesters{'CPL'}, $bibnum2, >+ $constraint, $bibitems, 3, $resdate, $expdate, $notes, >+ $title, $checkitem, $found); >+ModReserveAffect($itemnum_cpl, $requesters{'RPL'}, 0); >+ >+# Now it should have different priorities. >+my $title_reserves = GetReservesFromBiblionumber({biblionumber => $bibnum2}); >+# Sort by reserve number in case the database gives us oddly ordered results >+my @reserves = sort { $a->{reserve_id} <=> $b->{reserve_id} } @$title_reserves; >+is($reserves[0]{priority}, 0, 'Item is correctly waiting'); >+is($reserves[1]{priority}, 1, 'Item is correctly priority 1'); >+is($reserves[2]{priority}, 2, 'Item is correctly priority 2'); >+ >+ >+$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); > AddReserve('RPL', $requesters{'RPL'}, $bibnum2, > $constraint, $bibitems, 1, $resdate, $expdate, $notes, > $title, $checkitem, $found); >-- >1.8.3.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11947
:
26395
|
26396
|
26416
|
26427
|
26428
|
26429
|
26498
|
27035
| 27122