[Bug 16335] New: Refactor OpacHiddenItems
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335 Bug ID: 16335 Summary: Refactor OpacHiddenItems Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: mtompset@hotmail.com QA Contact: testopia@bugs.koha-community.org See 14385 and 10589 as well. The problem is this functionality would be better written using the newer Koha::RecordProcessor filtering functionality. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |mtompset@hotmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335 --- Comment #1 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 52094 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52094&action=edit Bug 16335: Refactor OpacHiddenItems This creates a filter and adds a test file for that filter. TEST PLAN --------- 1) apply patch 2) prove t/db_dependent/Filter_MARC_OpacHiddenItems.t 3) run koha qa test tools NOTE: I'd ignore the only once warnings. https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16104#c18 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52094|0 |1 is obsolete| | --- Comment #2 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 52102 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52102&action=edit Bug 16335: Refactor OpacHiddenItems This creates a filter and adds a test file for that filter. TEST PLAN --------- 1) apply patch 2) prove t/db_dependent/Filter_MARC_OpacHiddenItems.t 3) run koha qa test tools NOTE: I'd ignore the only once warnings. https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16104#c18 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52102|0 |1 is obsolete| | --- Comment #3 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 52103 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52103&action=edit Bug 16335: Refactor OpacHiddenItems This creates a filter and adds a test file for that filter. TEST PLAN --------- 1) apply patch 2) prove t/db_dependent/Filter_MARC_OpacHiddenItems.t 3) run koha qa test tools NOTE: I'd ignore the only once warnings. https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16104#c18 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335 --- Comment #4 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 55608 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=55608&action=edit Bug 16335: get_instance was changed to new? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hi Mark, are you still working in this? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16335 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |WORKSFORME CC| |tomascohen@gmail.com --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- 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.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org