https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335

Tomás Cohen Arazi <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |WORKSFORME
                 CC|                            |[email protected]

--- Comment #6 from Tomás Cohen Arazi <[email protected]> ---
I don't think this is required anymore.

We now pivot on the Koha::Biblio and Koha::Item classes instead of MARC::Record
objects, and we have high level methods to deal with this things:

Koha::Biblio->hidden_in_opac
Koha::Item->hidden_in_opac

and notably

Koha::Items->filter_by_visible_in_opac

They are all aware of OpacHiddenItems and more hiding options as well.
We also have

Koha::Item->as_marc_field

which makes a MARC::Field object out of an item.

So if we wanted to (say) do something with a MARC record, that includes items,
in the OPAC, we could (just a mock, but you get the idea):

my $biblio = Koha::Biblios->find( $biblio_id, { prefetch => [ 'metadata',
'items' ] } );
my $items  = $biblio->items;

unless ( $patron and $patron->category->override_hidden_items ) {
    $items = $items->filter_by_visible_in_opac({ patron => $patron });
}

my $record = $biblio->metadata->record;
my $processor = Koha::RecordProcessor->new(
    {
        filters => ('EmbedItems', 'ViewPolicy'),
        options => {
            interface => 'opac',
            framework => $biblio->frameworkcode,
            items     => $items->as_list
        }
    }
);
$processor->process( $record );

As you can see, any further hiding of things in the MARC record, should already
be covered by the ViewPolicy filter, applied after the items embedding.

I think Mark will be happy to know we followed his path of fixing this mess!

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to