Bugzilla – Attachment 114188 Details for
Bug 15448
Placing hold on specific items doesn't enforce OpacHiddenItems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15448: Filter out items hidden in OPAC on placing hold
Bug-15448-Filter-out-items-hidden-in-OPAC-on-placi.patch (text/plain), 2.78 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-12-04 12:21:50 UTC
(
hide
)
Description:
Bug 15448: Filter out items hidden in OPAC on placing hold
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-12-04 12:21:50 UTC
Size:
2.78 KB
patch
obsolete
>From 3d7aa38c01e492b72d8ad50f05092d6a88bd0d2e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 4 Dec 2020 08:21:36 -0300 >Subject: [PATCH] Bug 15448: Filter out items hidden in OPAC on placing hold > >This patch leverages on bug 24254's >Koha::Items->filter_by_visible_in_opac to filter out items that >shouldn't be presented to the end user in the OPAC interface. > >To test: >1. Circulation and Fine rules for item-level holds are set to allow. >2. Setting the OpacHiddenItems preference to "ccode: [SUPPRESS]" >3. An item with collection Code Suppress is set. >4. Search for the title in the OPAC. >=> SUCCESS: The Suppress ccode item isn't shown. >5. View the detail page for the title. >=> SUCCESS: The suppress ccode item isn't shown. >6. Place a hold on the item: > -- Click "Show more options" > -- Select "A specific item" >=> FAIL: the ccode with the opachiddenitems rule has an item that appear in the list to place a hold >7. Apply this patch and repeat 6 >=> SUCCESS: The item doesn't show! >8. Sign off :-D >--- > opac/opac-reserve.pl | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index b0ed0886895..e2d101a186f 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -42,6 +42,7 @@ use Koha::ItemTypes; > use Koha::Checkouts; > use Koha::Libraries; > use Koha::Patrons; >+use Koha::Util::SystemPreferences qw(get_yaml_pref_hash); > use Date::Calc qw/Today Date_to_Days/; > use List::MoreUtils qw/uniq/; > >@@ -71,6 +72,7 @@ for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { > } > > my $patron = Koha::Patrons->find( $borrowernumber ); >+my $category = $patron->category; > > my $can_place_hold_if_available_at_pickup = C4::Context->preference('OPACHoldsIfAvailableAtPickup'); > unless ( $can_place_hold_if_available_at_pickup ) { >@@ -461,6 +463,18 @@ foreach my $biblioNum (@biblionumbers) { > my @notforloan_avs = Koha::AuthorisedValues->search_by_koha_field({ kohafield => 'items.notforloan', frameworkcode => $frameworkcode }); > my $notforloan_label_of = { map { $_->authorised_value => $_->opac_description } @notforloan_avs }; > >+ # no OpacHiddenItems rules used if category is excepted >+ my $rules = >+ ( $category->override_hidden_items ) >+ ? {} >+ : get_yaml_pref_hash('OpacHiddenItems'); >+ >+ my $visible_items = { map { $_->itemnumber => 1 } $biblio->items->filter_by_visible_in_opac( { rules => $rules } ) }; >+ >+ # Only keep the items that are visible in the opac (i.e. those in %visible_items) >+ # FIXME: We should get rid of itemInfos altogether and use $visible_items >+ $biblioData->{itemInfos} = [ grep { $visible_items->{ $_->{itemnumber} } } @{ $biblioData->{itemInfos} } ]; >+ > $biblioLoopIter{itemLoop} = []; > my $numCopiesAvailable = 0; > my $numCopiesOPACAvailable = 0; >-- >2.29.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 15448
:
46100
|
113875
|
113876
|
114188
|
114189
|
114191
|
114193
|
114194
|
114208
|
114209
|
114263
|
114264
|
114578
|
115133
|
115134