Bugzilla – Attachment 111720 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), 4.79 KB, created by
Arthur Suzuki
on 2020-10-15 12:22:24 UTC
(
hide
)
Description:
Bug 25408: (QA follow-up)
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2020-10-15 12:22:24 UTC
Size:
4.79 KB
patch
obsolete
>From 1c47d1de544872a2a197a518038ab7b311df9e43 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 15 Oct 2020 08:07:21 +0200 >Subject: [PATCH] Bug 25408: (QA follow-up) > >--- > C4/Reserves.pm | 5 +++-- > reserve/placerequest.pl | 6 +++--- > reserve/request.pl | 4 ++-- > 3 files changed, 8 insertions(+), 7 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 8add2b1b91..348e6e58db 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -330,7 +330,7 @@ sub CanBookBeReserved{ > my $canReserve = { status => '' }; > foreach my $itemnumber (@itemnumbers) { > $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params ); >- my $opacitemholds = $canReserve->{rights}->{opacitemholds}; >+ my $opacitemholds = $canReserve->{rights}->{opacitemholds} // 'Y'; > return { status => 'RecordHoldNotAllowed' } if $opacitemholds eq 'F'; > return { status => 'OK' } if ( $canReserve->{status} eq 'notReservable' && $opacitemholds eq 'N' ); > return { status => 'OK' } if $canReserve->{status} eq 'OK'; >@@ -370,6 +370,7 @@ 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 $context = $params->{context} // ''; > > # we retrieve borrowers and items informations # > # item->{itype} will come for biblioitems if necessery >@@ -436,7 +437,7 @@ sub CanItemBeReserved { > > my $holds = Koha::Holds->search($search_params); > >- if ( $opacitemholds eq "N" ) { >+ if ( $opacitemholds eq "N" && $context ne 'staff' ) { > return { status => "notReservable", rights => $rights }; > } > >diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl >index ea81592ef0..6943abcb48 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( >@@ -123,7 +123,7 @@ if ( $type eq 'str8' && $borrower ) { > > } elsif (@biblionumbers > 1) { > my $bibinfo = $bibinfos{$biblionumber}; >- 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, >@@ -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 503a6764c9..7def8f5ac1 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -297,7 +297,7 @@ foreach my $biblionumber (@biblionumbers) { > my $force_hold_level; > if ( $patron ) { > { # CanBookBeReserved >- my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); >+ my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber, undef, { context => 'staff' }); > if ( $canReserve->{status} eq 'OK' ) { > > #All is OK and we can continue >@@ -557,7 +557,7 @@ foreach my $biblionumber (@biblionumbers) { > > $item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; > >- my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}; >+ my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber, undef, { context => 'staff'} )->{status}; > $item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' ); > > $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); >-- >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