Bugzilla – Attachment 156153 Details for
Bug 34886
Regression in when hold button appears
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34886: Move patron check onto C4/Reserves.pm
Bug-34886-Move-patron-check-onto-C4Reservespm.patch (text/plain), 3.15 KB, created by
Pedro Amorim
on 2023-09-25 12:50:36 UTC
(
hide
)
Description:
Bug 34886: Move patron check onto C4/Reserves.pm
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-09-25 12:50:36 UTC
Size:
3.15 KB
patch
obsolete
>From cf0c6b4dcc1425af8b176f8645040815058eef8c Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 25 Sep 2023 12:30:16 +0000 >Subject: [PATCH] Bug 34886: Move patron check onto C4/Reserves.pm > >Rollback changes in opac-detail.pl > >Run tests: >prove t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t >prove t/db_dependent/Reserves.t > >Bug 15534 changed onshelfholds going from 0/1 circ rule to 0/1/2 >But the check in opac-detail.pl still remained checking for just a positive value. >Currently, onshelfholds is as follows: >1 - Yes >0 - If any unavailable >2 - If all unavailable > >I think the check needs to be updated to only when onshelfholds = 1 (Yes), which is effectively done in IsAvailableForItemLevelRequest in C4/Reserves.pm, with the caveat that when onshelfholds = 2, it requires the $patron to exist to do the full check. > >This patch fixes the issue. But also makes it so that the "Place hold" link only shows for the unauthenticated user if onshelfholds = "Yes", whereas before it showed for the unauthenticated user if onshelfholds = "Yes" OR if onshelfholds = "If all unavailable" >--- > C4/Reserves.pm | 4 ++-- > opac/opac-detail.pl | 7 +------ > 2 files changed, 3 insertions(+), 8 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 3625737885..d88626916e 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1369,7 +1369,7 @@ sub IsAvailableForItemLevelRequest { > > if ( $on_shelf_holds == 1 ) { > return 1; >- } elsif ( $on_shelf_holds == 2 ) { >+ } elsif ( $on_shelf_holds == 2 && $patron) { > > # These calculations work at the biblio level, and can be expensive > # we use the in-memory cache to avoid calling once per item when looping items on a biblio >@@ -1424,7 +1424,7 @@ sub ItemsAnyAvailableAndNotRestricted { > || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan > || $branchitemrule->{holdallowed} eq 'from_home_library' && $param->{patron}->branchcode ne $i->homebranch > || $branchitemrule->{holdallowed} eq 'from_local_hold_group' && ! $item_library->validate_hold_sibling( { branchcode => $param->{patron}->branchcode } ) >- || CanItemBeReserved( $param->{patron}, $i )->{status} ne 'OK'; >+ || $param->{patron} && CanItemBeReserved( $param->{patron}, $i )->{status} ne 'OK'; > } > > return 0; >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 59eeedcfe1..7191625a31 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -682,12 +682,7 @@ else { > $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding; > $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home; > >- if ( $patron ) { >- $has_reservable_items = IsAvailableForItemLevelRequest($item, $patron, undef); >- } else { >- $has_reservable_items = >- Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => undef } ); >- } >+ $has_reservable_items = $has_reservable_items || IsAvailableForItemLevelRequest ( $item, $patron, undef ); > > # get collection code description, too > my $ccode = $item->ccode; >-- >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 34886
:
156107
|
156114
|
156150
|
156151
|
156152
|
156153
|
156277
|
156278
|
156279
|
156293
|
156294
|
156295
|
156326
|
156327
|
156980
|
156981
|
159678
|
159679
|
161633
|
161634
|
161981
|
161982
|
163674
|
164106
|
164107
|
164108
|
164109
|
164110
|
164159
|
164160
|
164161