Bugzilla – Attachment 113876 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: Copy code to opac-reserve.pl
Bug-15448-Copy-code-to-opac-reservepl.patch (text/plain), 2.61 KB, created by
Jonathan Druart
on 2020-11-20 11:26:14 UTC
(
hide
)
Description:
Bug 15448: Copy code to opac-reserve.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-11-20 11:26:14 UTC
Size:
2.61 KB
patch
obsolete
>From fac42fc9a4daab026b41eb72510ee1094b7aebc9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 20 Nov 2020 12:20:44 +0100 >Subject: [PATCH] Bug 15448: Copy code to opac-reserve.pl > >So yes, this code must be moved to a module, and use in the different >places when the items are not hidden at the OPAC (See bug 24403). >Call this a first step. >--- > opac/opac-reserve.pl | 51 +++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 50 insertions(+), 1 deletion(-) > >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index b0ed088689..c9a852b903 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -43,7 +43,7 @@ use Koha::Checkouts; > use Koha::Libraries; > use Koha::Patrons; > use Date::Calc qw/Today Date_to_Days/; >-use List::MoreUtils qw/uniq/; >+use List::MoreUtils qw/uniq any/; > > my $maxreserves = C4::Context->preference("maxreserves"); > >@@ -586,6 +586,12 @@ foreach my $biblioNum (@biblionumbers) { > > push @{$biblioLoopIter{itemLoop}}, $itemLoopIter; > } >+ $biblioLoopIter{itemLoop} = [ >+ filter_items({ >+ items => $biblioLoopIter{itemLoop}, >+ patron => $patron, >+ }) >+ ]; > $template->param( > itemdata_enumchron => $itemdata_enumchron, > itemdata_ccode => $itemdata_ccode, >@@ -676,3 +682,46 @@ if ( > } > > output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >+ >+sub filter_items { >+ my ( $params ) = @_; >+ my @all_items = @{$params->{items}}; >+ my $patron = $params->{patron}; >+ my @hiddenitems; >+ my $patron_category = >+ ( C4::Context->preference('OpacHiddenItemsExceptions') && $patron ) >+ ? $patron->categorycode >+ : undef; >+ >+ if ( scalar @all_items >= 1 ) { >+ push @hiddenitems, >+ GetHiddenItemnumbers( { items => \@all_items, borcat => $patron_category } ); >+ >+ return () if scalar @hiddenitems == scalar @all_items; >+ } >+ >+ my @items; >+ # Are there items to hide? >+ my $hideitems; >+ >+ # Hide items >+ if ( C4::Context->preference('hidelostitems') || @hiddenitems ) { >+ for my $itm (@all_items) { >+ if ( C4::Context->preference('hidelostitems') ) { >+ push @items, $itm >+ unless $itm->{itemlost} >+ or any { $itm->{'itemnumber'} eq $_ } @hiddenitems; >+ } >+ else { >+ push @items, $itm >+ unless any { $itm->{'itemnumber'} eq $_ } @hiddenitems; >+ } >+ } >+ } >+ # Or not >+ else { >+ @items = @all_items; >+ } >+ return @items; >+} >+ >-- >2.20.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 15448
:
46100
|
113875
|
113876
|
114188
|
114189
|
114191
|
114193
|
114194
|
114208
|
114209
|
114263
|
114264
|
114578
|
115133
|
115134