Bugzilla – Attachment 105991 Details for
Bug 20985
CanBookBeReserved and CanItemBeReserved should check 'On shelf holds allowed' policy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20985: Add OnShelfHoldsAllowed checks to CanItemBeReserved
Bug-20985-Add-OnShelfHoldsAllowed-checks-to-CanIte.patch (text/plain), 4.83 KB, created by
Arthur Suzuki
on 2020-06-17 23:03:02 UTC
(
hide
)
Description:
Bug 20985: Add OnShelfHoldsAllowed checks to CanItemBeReserved
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2020-06-17 23:03:02 UTC
Size:
4.83 KB
patch
obsolete
>From 06ab7574c654beaebde8c33d43b793bb71ea27f5 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 21 Mar 2019 21:52:06 +0100 >Subject: [PATCH] Bug 20985: Add OnShelfHoldsAllowed checks to > CanItemBeReserved > >Test plan : >1 / Check that default circulation have OnShelfHoldsAllowed to Yes >2 / Place a hold on a book with a single item, item being available for loan, verify that hold can be placed. >3 / Set OnShelfHoldsAllowed to any other value, verify that hold cannot be placed for reason "onShelfHoldsNotAllowed" (shown in the item table). >--- > C4/Reserves.pm | 17 ++++++++++++++++- > t/db_dependent/Reserves.t | 4 ++++ > 2 files changed, 20 insertions(+), 1 deletion(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 28776858dd..7785b9e422 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -340,6 +340,7 @@ sub CanBookBeReserved{ > if ($canReserve->{status} eq 'OK') { #We can reserve this Item! } > > @RETURNS { status => OK }, if the Item can be reserved. >+ { status => onShelfHoldsNotAllowed }, if onShelfHoldsAllowed parameter and item availability combination doesn't allow holds. > { status => ageRestricted }, if the Item is age restricted for this borrower. > { status => damaged }, if the Item is damaged. > { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK. >@@ -362,12 +363,14 @@ sub CanItemBeReserved { > my $holds_per_record = 1; # Total number of holds allowed for this one given record > my $holds_per_day; # Default to unlimited > my $opacitemholds = 'Y'; # Itemlevel holds default to allowed >+ my $on_shelf_holds = 0; # Default to "if any unavailable" > > # Get calling context > my $caller = (caller(1))[3]; > > # we retrieve borrowers and items informations # > # item->{itype} will come for biblioitems if necessery >+ > my $item = Koha::Items->find($itemnumber); > my $biblio = $item->biblio; > my $patron = Koha::Patrons->find( $borrowernumber ); >@@ -417,6 +420,7 @@ sub CanItemBeReserved { > $holds_per_record = $rights->{holds_per_record} // $holds_per_record; > $holds_per_day = $rights->{holds_per_day}; > $opacitemholds = $rights->{opacitemholds}; >+ $on_shelf_holds = $rights->{onshelfholds}; > } > else { > $ruleitemtype = undef; >@@ -426,6 +430,16 @@ sub CanItemBeReserved { > return { status => "notReservable" }; > } > >+ # Check for item on shelves and OnShelfHoldsAllowed >+ return { status => 'onShelfHoldsNotAllowed' } >+ if ( 0 == ( >+ $item->{'notforloan'} or >+ $item->{'onloan'} or >+ $item->{'itemlost'} or >+ $item->{'withdrawn'} or >+ $item->{'damaged'} ) >+ && ($on_shelf_holds != "1")); >+ > $item = Koha::Items->find( $itemnumber ); > > my $holds = Koha::Holds->search( >@@ -2268,7 +2282,7 @@ sub GetHoldRule { > itemtype => $itemtype, > categorycode => $categorycode, > branchcode => $branchcode, >- rules => ['holds_per_record', 'holds_per_day', 'opacitemholds'], >+ rules => ['holds_per_record', 'holds_per_day', 'opacitemholds', 'onshelfholds'], > order_by => { > -desc => [ 'categorycode', 'itemtype', 'branchcode' ] > } >@@ -2277,6 +2291,7 @@ sub GetHoldRule { > $rules->{holds_per_record} = $holds_per_x_rules->{holds_per_record}; > $rules->{holds_per_day} = $holds_per_x_rules->{holds_per_day}; > $rules->{opacitemholds} = $holds_per_x_rules->{opacitemholds}; >+ $rules->{onshelfholds} = $holds_per_x_rules->{onshelfholds}; > > return $rules; > } >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 84c02599a0..b8d519f7a9 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -190,6 +190,7 @@ Koha::CirculationRules->set_rules( > rules => { > reservesallowed => 25, > holds_per_record => 1, >+ onshelfholds => 1, > } > } > ); >@@ -1000,6 +1001,7 @@ subtest 'reserves.item_level_hold' => sub { > rules => { > reservesallowed => 25, > opacitemholds => 'F', >+ onshelfholds => 1, > } > } > ); >@@ -1029,6 +1031,7 @@ subtest 'reserves.item_level_hold' => sub { > rules => { > reservesallowed => 25, > opacitemholds => 'N', >+ onshelfholds => 1, > } > } > ); >@@ -1057,6 +1060,7 @@ subtest 'reserves.item_level_hold' => sub { > rules => { > reservesallowed => 25, > opacitemholds => 'Y', >+ onshelfholds => 1, > } > } > ); >-- >2.20.1
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 20985
:
86874
|
89723
|
105991
|
110095
|
111954
|
112688
|
113730
|
113731
|
114801
|
114802
|
114804
|
114805
|
115732
|
115733
|
121100
|
121101
|
121102
|
121139
|
121176
|
121185
|
121186
|
121485
|
121486
|
154711