Bug 23247: Use EmbedItems in opac-MARCdetail.pl

This patch uses the EmbedItems processor to add the items to the MARC
record.

To test:
- Find a known record, go to the OPAC MARC page of it.
- Play with several options in OpacHiddenItems, refreshing it
- Play with OpacHiddenItemsExceptions as well
=> SUCCESS: Things work as expected
- Apply this patch
- Repeate the tests above
=> SUCCESS: Things work as expected!
- Sign off :-D

Seems to work as advertised.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: LMSCloudPaulD <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2022-07-22 16:46:51 -03:00
parent f1ca05ac77
commit 801cace195
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 8 additions and 11 deletions

View File

@ -92,13 +92,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $patron = Koha::Patrons->find($loggedinuser);
my $biblio = Koha::Biblios->find($biblionumber);
my $record = $biblio->metadata->record(
{
embed_items => 1,
opac => 1,
patron => $patron,
}
);
my $record = $biblio->metadata->record;
if ( ! $record ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
@ -113,14 +108,16 @@ unless ( $patron and $patron->category->override_hidden_items ) {
}
}
my $items = $biblio->items->filter_by_visible_in_opac({ patron => $patron });
my $framework = $biblio ? $biblio->frameworkcode : q{};
my $tagslib = &GetMarcStructure( 0, $framework );
my $record_processor = Koha::RecordProcessor->new({
filters => 'ViewPolicy',
filters => [ 'EmbedItems', 'ViewPolicy' ],
options => {
interface => 'opac',
frameworkcode => $framework
interface => 'opac',
frameworkcode => $framework,
items => [ $items->as_list ],
}
});
$record_processor->process($record);
@ -140,7 +137,7 @@ $template->param(
$tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8;
my $allow_onshelf_holds;
my $items = $biblio->items;
$items->reset;
while ( my $item = $items->next ) {
$allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )