Bugzilla – Attachment 120662 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: Take OpacHiddenItems into account on opac-shelves
Bug-28299-Take-OpacHiddenItems-into-account-on-opa.patch (text/plain), 7.84 KB, created by
Jonathan Druart
on 2021-05-07 09:18:35 UTC
(
hide
)
Description:
Bug 28299: Take OpacHiddenItems into account on opac-shelves
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-05-07 09:18:35 UTC
Size:
7.84 KB
patch
obsolete
>From c2ef7765836fcd96e390de59ac167c854ff7e6f0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 7 May 2021 11:16:17 +0200 >Subject: [PATCH] Bug 28299: Take OpacHiddenItems into account on opac-shelves > >hidden_items was not passed to XSLTParse4Display > >2 things: >* Should we hide the biblio record if OpacHiddenItemsHidesRecord is set? >* allow_onshelf_holds is not working like in other scripts, what's the >expected behaviour? If hidden should we completely ignore the item? >--- > .../bootstrap/en/modules/opac-shelves.tt | 15 +++--- > opac/opac-shelves.pl | 52 +++++++++++-------- > 2 files changed, 38 insertions(+), 29 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 3bdb18b6416..111031f9cd5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -524,14 +524,15 @@ > </span> > <span class="results_summary"> > <span class="label">Holdings:</span> >- [% IF ( itemsloo.ITEM_RESULTS ) %] >- [% FOREACH ITEM_RESULT IN itemsloo.ITEM_RESULTS %] >- [% ITEM_RESULT.homebranch | html %] >- [% IF ( ITEM_RESULT.location_opac ) %] >- <span class="shelvingloc">[% ITEM_RESULT.location_opac | html %]</span> >+ [% IF itemsloo.ITEM_RESULTS %] >+ [% FOREACH item IN itemsloo.ITEM_RESULTS %] >+ [% item.homebranch | html %] >+ [% SET location_opac = AuthorisedValues.GetByCode( 'LOC', item.location, 1 ) %] >+ [% IF location_opac %] >+ <span class="shelvingloc">[% location_opac | html %]</span> > [% END %] >- [% IF ( ITEM_RESULT.itemcallnumber ) %] >- ([% ITEM_RESULT.itemcallnumber | html %]) >+ [% IF item.itemcallnumber %] >+ ([% item.itemcallnumber | html %]) > [% IF ( loop.last ) %].[% ELSE %],[% END %] > [% END %] > [% END %] >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index b94b4126ea5..2d9d5613d9a 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -304,7 +304,7 @@ if ( $op eq 'view' ) { > $art_req_itypes = Koha::CirculationRules->guess_article_requestable_itemtypes({ $patron ? ( categorycode => $patron->categorycode ) : () }); > } > >- my @items; >+ my @items_info; > while ( my $content = $contents->next ) { > my $biblionumber = $content->biblionumber; > my $this_item = GetBiblioData($biblionumber); >@@ -317,19 +317,6 @@ if ( $op eq 'view' ) { > }); > $record_processor->process($record); > >- if ($xslfile) { >- my $variables = { >- anonymous_session => ($loggedinuser) ? 0 : 1 >- }; >- $this_item->{XSLTBloc} = XSLTParse4Display( >- $biblionumber, $record, >- "OPACXSLTListsDisplay", 1, >- undef, $sysxml, >- $xslfile, $lang, >- $variables >- ); >- } >- > my $marcflavour = C4::Context->preference("marcflavour"); > my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype; > $itemtype = Koha::ItemTypes->find( $itemtype ); >@@ -352,10 +339,6 @@ if ( $op eq 'view' ) { > $this_item->{size} = q||; > } > >- # Getting items infos for location display >- my @items_infos = &GetItemsLocationInfo( $biblionumber ); >- $this_item->{'ITEM_RESULTS'} = \@items_infos; >- > if (C4::Context->preference('TagsEnabled') and C4::Context->preference('TagsShowOnList')) { > $this_item->{TagLoop} = get_tags({ > biblionumber => $biblionumber, approved=>1, 'sort'=>'-weight', >@@ -363,10 +346,35 @@ if ( $op eq 'view' ) { > }); > } > >+ my @items; > my $items = $biblio->items; >+ my $allow_onshelf_holds; >+ my @hidden_items; > while ( my $item = $items->next ) { >- $this_item->{allow_onshelf_holds} = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); >- last if $this_item->{allow_onshelf_holds}; >+ if ( $item->hidden_in_opac({rules => C4::Context->yaml_preference('OpacHiddenItems')} ) ) { >+ push @hidden_items, $item->itemnumber; >+ next; >+ } >+ >+ $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; >+ >+ if ($xslfile) { >+ my $variables = { >+ anonymous_session => ($loggedinuser) ? 0 : 1 >+ }; >+ $this_item->{XSLTBloc} = XSLTParse4Display( >+ $biblionumber, $record, >+ "OPACXSLTListsDisplay", 1, >+ \@hidden_items, $sysxml, >+ $xslfile, $lang, >+ $variables >+ ); > } > > if ( grep {$_ eq $biblionumber} @cart_list) { >@@ -375,7 +383,7 @@ if ( $op eq 'view' ) { > > $this_item->{biblio_object} = $biblio; > $this_item->{biblionumber} = $biblionumber; >- push @items, $this_item; >+ push @items_info, $this_item; > } > > $template->param( >@@ -383,7 +391,7 @@ if ( $op eq 'view' ) { > can_delete_shelf => $shelf->can_be_deleted($loggedinuser), > can_remove_biblios => $shelf->can_biblios_be_removed($loggedinuser), > can_add_biblios => $shelf->can_biblios_be_added($loggedinuser), >- itemsloop => \@items, >+ itemsloop => \@items_info, > sortfield => $sortfield, > direction => $direction, > csv_profiles => [ >-- >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