Bugzilla – Attachment 115130 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: (QA follow-up)
Bug-25408-QA-follow-up.patch (text/plain), 3.75 KB, created by
Arthur Suzuki
on 2021-01-14 04:54:19 UTC
(
hide
)
Description:
Bug 25408: (QA follow-up)
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2021-01-14 04:54:19 UTC
Size:
3.75 KB
patch
obsolete
>From dfaf596a32fd054f231e1ca97aa7723ba1db3771 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 14 Jan 2021 05:28:12 +0100 >Subject: [PATCH] Bug 25408: (QA follow-up) > >Added handling of calling context (staff or else) >--- > C4/Reserves.pm | 6 ++++-- > reserve/placerequest.pl | 4 ++-- > reserve/request.pl | 6 +++--- > 3 files changed, 9 insertions(+), 7 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 327499dcd3..1cccd40b66 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -341,7 +341,8 @@ sub CanBookBeReserved{ > > foreach my $itemnumber (@itemnumbers) { > $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params ); >- return { status => 'recordHoldNotAllowed' } if $canReserve->{rights}->{opacitemholds} eq 'F'; >+ my $opacitemholds = $canReserve->{rights}->{opacitemholds} // 'Y'; >+ return { status => 'recordHoldNotAllowed' } if $opacitemholds eq 'F'; > return { status => 'OK' } if $canReserve->{status} eq 'OK'; > return { status => 'OK' } if $canReserve->{status} eq 'recordHoldsOnly'; > } >@@ -384,6 +385,7 @@ sub CanItemBeReserved { > my $biblio = $item->biblio; > my $patron = Koha::Patrons->find( $borrowernumber ); > my $borrower = $patron->unblessed; >+ my $context = $params->{context} // ''; > > # If an item is damaged and we don't allow holds on damaged items, we can stop right here > return { status =>'damaged' } >@@ -591,7 +593,7 @@ sub CanItemBeReserved { > } > } > >- if ( $opacitemholds eq "N" ) { >+ if ( $opacitemholds eq "N" && $context ne 'staff') { > return { status => "recordHoldsOnly", right => $rights }; > } > >diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl >index ea81592ef0..4e506cff9e 100755 >--- a/reserve/placerequest.pl >+++ b/reserve/placerequest.pl >@@ -99,7 +99,7 @@ if ( $type eq 'str8' && $borrower ) { > $biblionumber = $item->biblionumber; > } > >- my $can_item_be_reserved = CanItemBeReserved($borrower->{'borrowernumber'}, $item->itemnumber, $branch)->{status}; >+ my $can_item_be_reserved = CanItemBeReserved($borrower->{'borrowernumber'}, $item->itemnumber, $branch, { context => 'staff' })->{status}; > > if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) { > AddReserve( >@@ -144,7 +144,7 @@ if ( $type eq 'str8' && $borrower ) { > } else { > # place a request on 1st available > for ( my $i = 0 ; $i < $holds_to_place_count ; $i++ ) { >- if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) { >+ if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber, undef, { context => 'staff' })->{status} eq 'OK' ) { > AddReserve( > { > branchcode => $branch, >diff --git a/reserve/request.pl b/reserve/request.pl >index 57a4deff3f..9eb4b08db4 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -318,10 +318,10 @@ foreach my $biblionumber (@biblionumbers) { > $template->param( $canReserve->{status} => 1); > $biblioloopiter{ $canReserve->{status} } = 1; > } >- elsif ( $canReserve->{status} eq 'recordHoldNotAllowed' ) { >+ elsif ( $canReserve->{status} eq 'recordHoldNotAllowed' ) { > $template->param( $canReserve->{status} => 1 ); >- $biblioloopiter{ $canReserve->{status} } = 1; >- } >+ $biblioloopiter{ $canReserve->{status} } = 1; >+ } > else { > $biblioloopiter{ $canReserve->{status} } = 1; > } >-- >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 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