Bugzilla – Attachment 120756 Details for
Bug 28299
OpacHiddenItems not working in OPAC lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28299: Make buildKohaItemsNamespace accept Koha::Items
Bug-28299-Make-buildKohaItemsNamespace-accept-Koha.patch (text/plain), 3.73 KB, created by
Jonathan Druart
on 2021-05-10 08:01:23 UTC
(
hide
)
Description:
Bug 28299: Make buildKohaItemsNamespace accept Koha::Items
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-05-10 08:01:23 UTC
Size:
3.73 KB
patch
obsolete
>From c2c2269d5d762fdeb09ea78db35e8820511d0c01 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 10 May 2021 10:01:02 +0200 >Subject: [PATCH] Bug 28299: Make buildKohaItemsNamespace accept Koha::Items > >--- > C4/XSLT.pm | 25 ++++++++++++++++--------- > opac/opac-shelves.pl | 15 +++++---------- > 2 files changed, 21 insertions(+), 19 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index d4cdb832cdc..5aa0f7ce147 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -297,14 +297,21 @@ Is only used in this module currently. > sub buildKohaItemsNamespace { > my ($biblionumber, $hidden_items) = @_; > >- $hidden_items ||= []; >- my @items = Koha::Items->search( >- { >- 'me.biblionumber' => $biblionumber, >- 'me.itemnumber' => { not_in => $hidden_items } >- }, >- { prefetch => [ 'branchtransfers', 'reserves' ] } >- ); >+ if ( ref $hidden_items eq 'Koha::Items' ) { >+ $items = $items->search( >+ {}, >+ { prefetch => [ 'branchtransfers', 'reserves' ] } >+ ); >+ } else { >+ $hidden_items ||= []; >+ >+ $items = Koha::Items->search( >+ { >+ 'me.biblionumber' => $biblionumber, >+ 'me.itemnumber' => { not_in => $hidden_items } >+ { prefetch => [ 'branchtransfers', 'reserves' ] } >+ ); >+ } > > my $shelflocations = > { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; >@@ -318,7 +325,7 @@ sub buildKohaItemsNamespace { > my %descs = map { $_->{authorised_value} => $_ } Koha::AuthorisedValues->get_descriptions_by_koha_field( { kohafield => 'items.notforloan' } ); > my $ref_status = C4::Context->preference('Reference_NFL_Statuses') || '1|2'; > >- for my $item (@items) { >+ while ( my $item = $items->next ) { > my $status; > my $substatus = ''; > >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 2d9d5613d9a..d1783ca649c 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -346,23 +346,18 @@ if ( $op eq 'view' ) { > }); > } > >- my @items; >- my $items = $biblio->items; >+ my $items = $biblio->items->filter_by_visible_in_opac({ patron => $patron }); > my $allow_onshelf_holds; >- my @hidden_items; > while ( my $item = $items->next ) { >- if ( $item->hidden_in_opac({rules => C4::Context->yaml_preference('OpacHiddenItems')} ) ) { >- push @hidden_items, $item->itemnumber; >- next; >- } > >+ # This method must take a Koha::Items rs > $allow_onshelf_holds ||= Koha::CirculationRules->get_onshelfholds_policy( > { item => $item, patron => $patron } ); > >- push @items, $item; # This is for non-xslt only > } >+ > $this_item->{allow_onshelf_holds} = $allow_onshelf_holds; >- $this_item->{'ITEM_RESULTS'} = \@items; >+ $this_item->{'ITEM_RESULTS'} = $items; > > if ($xslfile) { > my $variables = { >@@ -371,7 +366,7 @@ if ( $op eq 'view' ) { > $this_item->{XSLTBloc} = XSLTParse4Display( > $biblionumber, $record, > "OPACXSLTListsDisplay", 1, >- \@hidden_items, $sysxml, >+ $items, $sysxml, > $xslfile, $lang, > $variables > ); >-- >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 28299
:
120662
|
120756
|
120769
|
120792
|
120795
|
121018
|
121021
|
121022
|
121023
|
122050
|
122051
|
122052
|
122196
|
122197
|
122198
|
122593
|
122594
|
122595