Bugzilla – Attachment 104488 Details for
Bug 25408
CanBookBeReserved & CanItemBeReserved should check "opacitemholds" policy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25408: Add "opacitemholds" checks in CanBookBeReserved
Bug-25408-Add-opacitemholds-checks-in-CanBookBeRes.patch (text/plain), 2.49 KB, created by
Arthur Suzuki
on 2020-05-07 10:38:02 UTC
(
hide
)
Description:
Bug 25408: Add "opacitemholds" checks in CanBookBeReserved
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2020-05-07 10:38:02 UTC
Size:
2.49 KB
patch
obsolete
>From 7afca277033c4bfaf4676285d08e9c36fcee1a2b Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 7 May 2020 12:33:46 +0200 >Subject: [PATCH] Bug 25408: Add "opacitemholds" checks in CanBookBeReserved > >test plan: >1) set issuingrule with opacitemholds set to "Force" >2) try to add a new hold using multi-hold >3) hold is placed on the record where it shouldn't >4) apply patch >5) retry to place same hold >6) success: hold cannot be placed since record-level hold is not available) >--- > C4/Reserves.pm | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 49a4445857..85a0f4fbfa 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -310,6 +310,8 @@ See CanItemBeReserved() for possible return values. > > sub CanBookBeReserved{ > my ($borrowernumber, $biblionumber, $pickup_branchcode) = @_; >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ my $borrower = $patron->unblessed; > > my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber"); > #get items linked via host records >@@ -319,8 +321,13 @@ sub CanBookBeReserved{ > } > > my $canReserve = { status => '' }; >+ my ($rights,$item); > foreach my $itemnumber (@itemnumbers) { >- $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode ); >+ $item = Koha::Items->find($itemnumber); >+ $rights = GetHoldRule( $borrower->{'categorycode'}, $item->{'itype'}, $pickup_branchcode ); >+ return { 'status' => 'RecordHoldNotAllowed' } if $rights->{opacitemholds} eq 'F'; >+ >+ $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode ); > return { status => 'OK' } if $canReserve->{status} eq 'OK'; > } > return $canReserve; >@@ -2270,7 +2277,7 @@ sub GetHoldRule { > itemtype => $itemtype, > categorycode => $categorycode, > branchcode => $branchcode, >- rules => ['holds_per_record', 'holds_per_day'], >+ rules => ['holds_per_record', 'holds_per_day', 'opacitemholds'], > order_by => { > -desc => [ 'categorycode', 'itemtype', 'branchcode' ] > } >@@ -2278,6 +2285,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}; > > return $rules; > } >-- >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 25408
:
104488
|
104496
|
105988
|
105989
|
105990
|
106413
|
106414
|
106521
|
106535
|
106536
|
106537
|
107777
|
107778
|
107779
|
107780
|
111681
|
111682
|
111693
|
111696
|
111716
|
111717
|
111718
|
111719
|
111720
|
111721
|
115125
|
115126
|
115127
|
115128
|
115129
|
115130
|
121524
|
121525
|
121526
|
121527
|
121528
|
121530
|
128505
|
130180
|
130181
|
132658
|
132660
|
132661