Bugzilla – Attachment 132661 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 & CanItemBeReserved
Bug-25408-Add-opacitemholds-checks-in-CanBookBeRes.patch (text/plain), 2.74 KB, created by
Arthur Suzuki
on 2022-03-31 07:20:58 UTC
(
hide
)
Description:
Bug 25408: Add "opacitemholds" checks in CanBookBeReserved & CanItemBeReserved
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2022-03-31 07:20:58 UTC
Size:
2.74 KB
patch
obsolete
>From f6ff108c4b2c5a1bd995e5bb13fd50021ef89b4e 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 & > CanItemBeReserved > >The rule "opacitemholds" seemed not to be controlled in some cases. >This patch adds a control for this issuingrule in such a way it is checked across all interfaces (staff, opac, api) >Added error message when trying to hold on the record and opacitemhold is set to "Force" to item-level hold > >To test: >0 - Apply patches >1 - Set rule to "Don't allow" item specific holds on opac >2 - Attempt to place hold on staff side >3 - Hold is still allowed >4 - Attempt to place hold from opac or api >5 - Hold is not allowed >6 - Change rule to 'force' >7 - Item-level hold can be placed in all interfaces >8 - Record-level hold cannot be placed in all interfaces > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > C4/Reserves.pm | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 54af13d7f0..58ca10d1c3 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -347,6 +347,11 @@ sub CanBookBeReserved{ > my $patron = Koha::Patrons->find( $borrowernumber ); > while ( my $item = $items->next ) { > $canReserve = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params ); >+ if ( C4::Context->interface eq 'opac' ) { >+ my $opacitemholds = $canReserve->{rights}->{opacitemholds} // 'Y'; >+ return { status => 'recordHoldNotAllowed' } if $opacitemholds eq 'F'; >+ return { status => 'OK' } if $canReserve->{status} eq 'recordHoldsOnly'; >+ } > return { status => 'OK' } if $canReserve->{status} eq 'OK'; > } > return $canReserve; >@@ -459,10 +464,11 @@ sub CanItemBeReserved { > categorycode => $borrower->{'categorycode'}, > itemtype => $item->effective_itemtype, > branchcode => $reserves_control_branch, >- rules => ['holds_per_record','holds_per_day'] >+ rules => ['holds_per_record','holds_per_day','opacitemholds'] > }); > my $holds_per_record = $rights->{holds_per_record} // 1; > my $holds_per_day = $rights->{holds_per_day}; >+ my $opacitemholds = $rights->{opacitemholds} // 'Y'; > > if ( defined $holds_per_record && $holds_per_record ne '' ){ > if ( $holds_per_record == 0 ) { >@@ -591,7 +597,11 @@ sub CanItemBeReserved { > } > } > >- return { status => 'OK' }; >+ if ( $opacitemholds eq "N" && C4::Context->interface eq 'opac') { >+ return { status => "recordHoldsOnly", rights => $rights }; >+ } >+ >+ return { status => 'OK', rights => $rights }; > } > > =head2 CanReserveBeCanceledFromOpac >-- >2.30.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 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
|
164680
|
164681
|
164682
|
164684
|
164685
|
164686
|
164693
|
164694
|
164878
|
164879
|
165111
|
165112
|
165442
|
165443
|
165444
|
165445