Bugzilla – Attachment 95780 Details for
Bug 23964
An item level hold when placed is set to Waiting, if ReservesNeedReturn is set to Automatic
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23964: (follow-up) We should check for only active holds when determining to set waiting
Bug-23964-follow-up-We-should-check-for-only-activ.patch (text/plain), 3.14 KB, created by
Nick Clemens
on 2019-11-25 11:33:26 UTC
(
hide
)
Description:
Bug 23964: (follow-up) We should check for only active holds when determining to set waiting
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2019-11-25 11:33:26 UTC
Size:
3.14 KB
patch
obsolete
>From a2ad9bbae22dfd211cda3e7b12732c0f340e838b Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 25 Nov 2019 11:32:32 +0000 >Subject: [PATCH] Bug 23964: (follow-up) We should check for only active holds > when determining to set waiting > >--- > C4/Reserves.pm | 2 +- > t/db_dependent/Reserves.t | 29 ++++++++++++++++++++++++----- > 2 files changed, 25 insertions(+), 6 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 415ad26dc6..8126cb3e81 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -189,7 +189,7 @@ sub AddReserve { > && ( $item->damaged && C4::Context->preference('AllowHoldsOnDamagedItems') || !$item->damaged ) > > # Lastly, if this already has holds, we shouldn't make it waiting for the new hold >- && !$item->holds->count ) >+ && !$item->current_holds->count ) > { > $priority = 0; > $found = 'W'; >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index dc2f49a4b0..c4073430a5 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -664,7 +664,7 @@ subtest '_koha_notify_reserve() tests' => sub { > }; > > subtest 'ReservesNeedReturns' => sub { >- plan tests => 13; >+ plan tests => 18; > > my $library = $builder->build_object( { class => 'Koha::Libraries' } ); > my $item_info = { >@@ -723,14 +723,33 @@ subtest 'ReservesNeedReturns' => sub { > $hold->delete; > $hold_1->delete; > >- $builder->build({ source => "Branchtransfer", value => { >- itemnumber => $item->itemnumber, >- datearrived => undef, >- } }); >+ my $transfer = $builder->build_object({ >+ class => "Koha::Item::Transfers", >+ value => { >+ itemnumber => $item->itemnumber, >+ datearrived => undef, >+ } >+ }); > $item->damaged(0)->store; > $hold = place_item_hold( $patron, $item, $library, $priority ); > is( $hold->found, undef, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); > is( $hold->priority, 1, 'If ReservesNeedReturns is 0 but item in transit the hold must not be set to waiting' ); >+ $hold->delete; >+ $transfer->delete; >+ >+ $hold = place_item_hold( $patron, $item, $library, $priority ); >+ is( $hold->priority, 0, 'If ReservesNeedReturns is 0 and no other status, priority must have been set to 0' ); >+ is( $hold->found, 'W', 'If ReservesNeedReturns is 0 and no other status, found must have been set waiting' ); >+ $hold_1 = place_item_hold( $patron, $item, $library, $priority ); >+ is( $hold_1->priority, 1, 'If ReservesNeedReturns is 0 but item has a hold priority is 1' ); >+ $hold_1->suspend(1)->store; # We suspend the hold >+ $hold->delete; # Delete the waiting hold >+ $hold = place_item_hold( $patron, $item, $library, $priority ); >+ is( $hold->priority, 0, 'If ReservesNeedReturns is 0 and other hold(s) suspended, priority must have been set to 0' ); >+ is( $hold->found, 'W', 'If ReservesNeedReturns is 0 and other hold(s) suspended, found must have been set waiting' ); >+ >+ >+ > > t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); # Don't affect other tests > }; >-- >2.11.0
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 23964
:
95016
|
95017
|
95021
|
95022
|
95111
|
95249
|
95544
|
95594
|
95595
|
95596
|
95597
|
95598
|
95599
|
95639
|
95640
|
95641
|
95642
|
95643
|
95644
|
95780
|
95781