Bugzilla – Attachment 128505 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) This rule should not apply when placing a hold from staff interface
Bug-25408-QA-follow-up-This-rule-should-not-apply-.patch (text/plain), 6.03 KB, created by
Arthur Suzuki
on 2021-12-14 12:10:40 UTC
(
hide
)
Description:
Bug 25408: (QA follow-up) This rule should not apply when placing a hold from staff interface
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2021-12-14 12:10:40 UTC
Size:
6.03 KB
patch
obsolete
>From 42b1f9b63125a542e72eedc6772829748e2e43d5 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Tue, 14 Dec 2021 11:44:18 +0100 >Subject: [PATCH] Bug 25408: (QA follow-up) This rule should not apply when > placing a hold from staff interface > >--- > C4/Reserves.pm | 8 +++++--- > .../intranet-tmpl/prog/en/modules/reserve/request.tt | 6 ++---- > reserve/placerequest.pl | 2 +- > reserve/request.pl | 4 ---- > t/db_dependent/Reserves.t | 2 +- > 5 files changed, 9 insertions(+), 13 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 9b6b1c0c22..9777cf397e 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -341,10 +341,12 @@ sub CanBookBeReserved{ > > foreach my $itemnumber (@itemnumbers) { > $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params ); >- my $opacitemholds = $canReserve->{rights}->{opacitemholds} // 'Y'; >- return { status => 'recordHoldNotAllowed' } if $opacitemholds eq 'F'; >+ 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 { status => 'OK' } if $canReserve->{status} eq 'recordHoldsOnly'; > } > return $canReserve; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index e3c7418715..f827863ddf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -367,7 +367,7 @@ > </div> > [% END %] > >- [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted || recordHoldNotAllowed ) %] >+ [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted ) %] > <div class="dialog alert"> > > [% UNLESS ( multi_hold ) %] >@@ -389,8 +389,6 @@ > <li> <strong>No items are available</strong> to be placed on hold.</li> > [% ELSIF ( maxreserves ) %] > <li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> has too many holds.</li> >- [% ELSIF ( recordHoldNotAllowed ) %] >- <li><strong>Record holds not allowed : </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> cannot put a record-level hold on this ressource.</li> > [% END # /IF exceeded_maxreserves %] > </ul> > [% ELSE # UNLESS multi_hold %] >@@ -566,7 +564,7 @@ > [% IF ( patron.borrowernumber ) %] > [% IF ( override_required ) %] > <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button> >- [% ELSIF ( none_available || recordHoldNotAllowed ) %] >+ [% ELSIF ( none_available ) %] > <button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button> > [% ELSE %] > <button type="submit" class="btn btn-default">Place hold</button> >diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl >index 3e048ee3cf..5ee8dce2f6 100755 >--- a/reserve/placerequest.pl >+++ b/reserve/placerequest.pl >@@ -142,7 +142,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, undef, { context => 'staff' })->{status} eq 'OK' ) { >+ if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) { > AddReserve( > { > branchcode => $branch, >diff --git a/reserve/request.pl b/reserve/request.pl >index 7885dfa8f9..a635ab1348 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -347,10 +347,6 @@ foreach my $biblionumber (@biblionumbers) { > $template->param( $canReserve->{status} => 1); > $biblioloopiter{ $canReserve->{status} } = 1; > } >- elsif ( $canReserve->{status} eq 'recordHoldNotAllowed' ) { >- $template->param( $canReserve->{status} => 1 ); >- $biblioloopiter{ $canReserve->{status} } = 1; >- } > else { > $biblioloopiter{ $canReserve->{status} } = 1; > } >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index c4afba6424..5c4b0b64df 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -1083,7 +1083,7 @@ subtest 'reserves.item_level_hold' => sub { > subtest 'test opacitemholds rules in staff context' => sub { > plan tests => 2; > >- C4::Context->interface('intranet'); >+ C4::Context->interface('intranet'); > Koha::CirculationRules->set_rules( > { > branchcode => undef, >-- >2.34.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
|
164680
|
164681
|
164682
|
164684
|
164685
|
164686
|
164693
|
164694
|
164878
|
164879
|
165111
|
165112
|
165442
|
165443
|
165444
|
165445