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? Test plan: 1. Without the patch 2. fill OpacHiddenItems with «damaged: [1]» 3. find a record with several item 4. mark one of them as damaged 5. OPAC: go to the record, you shouldn't see the damaged item 6. add the record to a list 7. see the list 8. in Availability you see the damaged item mentioned, this is the issue 9. apply the patches and restart the services 10. the list should not mention the damaged item :D Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
a47e87915b
commit
82cf4b82c2
2 changed files with 38 additions and 29 deletions
|
@ -524,14 +524,15 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="results_summary">
|
<span class="results_summary">
|
||||||
<span class="label">Holdings:</span>
|
<span class="label">Holdings:</span>
|
||||||
[% IF ( itemsloo.ITEM_RESULTS ) %]
|
[% IF itemsloo.ITEM_RESULTS %]
|
||||||
[% FOREACH ITEM_RESULT IN itemsloo.ITEM_RESULTS %]
|
[% FOREACH item IN itemsloo.ITEM_RESULTS %]
|
||||||
[% ITEM_RESULT.homebranch | html %]
|
[% item.homebranch | html %]
|
||||||
[% IF ( ITEM_RESULT.location_opac ) %]
|
[% SET location_opac = AuthorisedValues.GetByCode( 'LOC', item.location, 1 ) %]
|
||||||
<span class="shelvingloc">[% ITEM_RESULT.location_opac | html %]</span>
|
[% IF location_opac %]
|
||||||
|
<span class="shelvingloc">[% location_opac | html %]</span>
|
||||||
[% END %]
|
[% END %]
|
||||||
[% IF ( ITEM_RESULT.itemcallnumber ) %]
|
[% IF item.itemcallnumber %]
|
||||||
([% ITEM_RESULT.itemcallnumber | html %])
|
([% item.itemcallnumber | html %])
|
||||||
[% IF ( loop.last ) %].[% ELSE %],[% END %]
|
[% IF ( loop.last ) %].[% ELSE %],[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
|
@ -306,7 +306,7 @@ if ( $op eq 'view' ) {
|
||||||
$art_req_itypes = Koha::CirculationRules->guess_article_requestable_itemtypes({ $patron ? ( categorycode => $patron->categorycode ) : () });
|
$art_req_itypes = Koha::CirculationRules->guess_article_requestable_itemtypes({ $patron ? ( categorycode => $patron->categorycode ) : () });
|
||||||
}
|
}
|
||||||
|
|
||||||
my @items;
|
my @items_info;
|
||||||
while ( my $content = $contents->next ) {
|
while ( my $content = $contents->next ) {
|
||||||
my $biblionumber = $content->biblionumber;
|
my $biblionumber = $content->biblionumber;
|
||||||
my $this_item = GetBiblioData($biblionumber);
|
my $this_item = GetBiblioData($biblionumber);
|
||||||
|
@ -319,19 +319,6 @@ if ( $op eq 'view' ) {
|
||||||
});
|
});
|
||||||
$record_processor->process($record);
|
$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 $marcflavour = C4::Context->preference("marcflavour");
|
||||||
my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
|
my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
|
||||||
$itemtype = Koha::ItemTypes->find( $itemtype );
|
$itemtype = Koha::ItemTypes->find( $itemtype );
|
||||||
|
@ -354,10 +341,6 @@ if ( $op eq 'view' ) {
|
||||||
$this_item->{size} = q||;
|
$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')) {
|
if (C4::Context->preference('TagsEnabled') and C4::Context->preference('TagsShowOnList')) {
|
||||||
$this_item->{TagLoop} = get_tags({
|
$this_item->{TagLoop} = get_tags({
|
||||||
biblionumber => $biblionumber, approved=>1, 'sort'=>'-weight',
|
biblionumber => $biblionumber, approved=>1, 'sort'=>'-weight',
|
||||||
|
@ -365,10 +348,35 @@ if ( $op eq 'view' ) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my @items;
|
||||||
my $items = $biblio->items;
|
my $items = $biblio->items;
|
||||||
|
my $allow_onshelf_holds;
|
||||||
|
my @hidden_items;
|
||||||
while ( my $item = $items->next ) {
|
while ( my $item = $items->next ) {
|
||||||
$this_item->{allow_onshelf_holds} = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } );
|
if ( $item->hidden_in_opac({rules => C4::Context->yaml_preference('OpacHiddenItems')} ) ) {
|
||||||
last if $this_item->{allow_onshelf_holds};
|
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) {
|
if ( grep {$_ eq $biblionumber} @cart_list) {
|
||||||
|
@ -377,7 +385,7 @@ if ( $op eq 'view' ) {
|
||||||
|
|
||||||
$this_item->{biblio_object} = $biblio;
|
$this_item->{biblio_object} = $biblio;
|
||||||
$this_item->{biblionumber} = $biblionumber;
|
$this_item->{biblionumber} = $biblionumber;
|
||||||
push @items, $this_item;
|
push @items_info, $this_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->param(
|
$template->param(
|
||||||
|
@ -385,7 +393,7 @@ if ( $op eq 'view' ) {
|
||||||
can_delete_shelf => $shelf->can_be_deleted($loggedinuser),
|
can_delete_shelf => $shelf->can_be_deleted($loggedinuser),
|
||||||
can_remove_biblios => $shelf->can_biblios_be_removed($loggedinuser),
|
can_remove_biblios => $shelf->can_biblios_be_removed($loggedinuser),
|
||||||
can_add_biblios => $shelf->can_biblios_be_added($loggedinuser),
|
can_add_biblios => $shelf->can_biblios_be_added($loggedinuser),
|
||||||
itemsloop => \@items,
|
itemsloop => \@items_info,
|
||||||
sortfield => $sortfield,
|
sortfield => $sortfield,
|
||||||
direction => $direction,
|
direction => $direction,
|
||||||
csv_profiles => [
|
csv_profiles => [
|
||||||
|
|
Loading…
Reference in a new issue