Bugzilla – Attachment 72889 Details for
Bug 16787
'Too many holds' message appears inappropriately and is missing data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16787: (follow-up) Return noReservesAllowed if 0 holds per record
Bug-16787-follow-up-Return-noReservesAllowed-if-0-.patch (text/plain), 3.23 KB, created by
Nick Clemens (kidclamp)
on 2018-03-14 15:57:28 UTC
(
hide
)
Description:
Bug 16787: (follow-up) Return noReservesAllowed if 0 holds per record
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-03-14 15:57:28 UTC
Size:
3.23 KB
patch
obsolete
>From 2898375444876949a2a0841b5300d2850c665b05 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 14 Mar 2018 13:43:29 +0000 >Subject: [PATCH] Bug 16787: (follow-up) Return noReservesAllowed if 0 holds > per record > >To test: >1 - Set 'Holds per record' to 0 for some itemtype/patorn combination >2 - Attempt to plac a hold >3 - Will see 'Too many..' >4 - Apply patch >5 - Try again >6 - Should now see 'No holds..' >7 - prove -v t/db_dependent/Holds.t >--- > C4/Reserves.pm | 3 +++ > t/db_dependent/Holds.t | 13 ++++++++++++- > 2 files changed, 15 insertions(+), 1 deletion(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 4e9a1b9..b518e7e 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -363,6 +363,9 @@ sub CanItemBeReserved { > found => undef, # Found holds don't count against a patron's holds limit > } > ); >+ if ( $holds_per_record == 0 ) { >+ return "noReservesAllowed"; >+ } > if ( $holds->count() >= $holds_per_record ) { > return "tooManyHoldsForThisRecord"; > } >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 6829aff..6b91527 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -331,9 +331,13 @@ subtest 'CanItemBeReserved' => sub { > q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) VALUES (?, ?, ?, ?, ?)}, {}, > '*', '*', 'CAN', 2, 2 > ); >+ $dbh->do( >+ q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) VALUES (?, ?, ?, ?, ?)}, {}, >+ '*', '*', 'CANNOT_RECORD', 0, 0 >+ ); > > subtest 'noReservesAllowed' => sub { >- plan tests => 4; >+ plan tests => 5; > > my ( $biblionumber_cannot ) = create_helper_biblio('CANNOT'); > my ( undef, undef, $itemnumber_1_can ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CAN' } , $biblionumber_cannot); >@@ -343,6 +347,9 @@ subtest 'CanItemBeReserved' => sub { > my ( undef, undef, $itemnumber_2_can ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CAN' } , $biblionumber_can); > my ( undef, undef, $itemnumber_2_cannot ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CANNOT' } , $biblionumber_can); > >+ my ($biblionumber_record_cannot) = create_helper_biblio('CANNOT_RECORD'); >+ my ( undef, undef, $itemnumber_3_cannot ) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CANNOT_RECORD' } , $biblionumber_record_cannot); >+ > Koha::Holds->search({borrowernumber => $borrowernumbers[0]})->delete; > > t::lib::Mocks::mock_preference('item-level_itypes', 1); >@@ -363,6 +370,10 @@ subtest 'CanItemBeReserved' => sub { > CanItemBeReserved( $borrowernumbers[0], $itemnumber_2_cannot), 'OK', > "With biblio level set, rule from biblio must be picked (CAN)" > ); >+ is( >+ CanItemBeReserved( $borrowernumbers[0], $itemnumber_3_cannot), 'noReservesAllowed', >+ "When no holds allowed and no holds per record allowed should return noReservesAllowed" >+ ); > }; > > subtest 'tooManyHoldsForThisRecord + tooManyReserves + itemAlreadyOnHold' => sub { >-- >2.1.4
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 16787
:
52652
|
68894
|
68895
|
72827
|
72828
|
72889
|
91146
|
91147
|
91148
|
91149
|
96152
|
97403
|
99949
|
99950
|
100951
|
101473
|
101474
|
101475
|
101895
|
107793
|
107794
|
107795
|
114675
|
114676
|
114677
|
119279
|
119280
|
119281
|
119335
|
119336
|
119337
|
119616
|
119617
|
119619
|
119620
|
119621
|
119622
|
119623
|
119738
|
119739
|
119740
|
119741
|
119942
|
120009