[Bug 44284] New: MARC view in the staff interface hides subfields whose visibility is -5 (OPAC, staff interface, collapsed)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 Bug ID: 44284 Summary: MARC view in the staff interface hides subfields whose visibility is -5 (OPAC, staff interface, collapsed) Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Target Milestone: --- catalogue/MARCdetail.pl skips subfields that are hidden in the staff interface with an unanchored regular expression: next if ( $sf->{hidden} =~ /-7|-4|-3|-2|2|3|5|8/ ); -5 (OPAC + Intranet + Collapsed checked, Editor not) contains "5", so it matches and the subfield is not shown, although "Intranet" is checked. The same test is used for control fields (line 159) and for the item subfields (line 250). To reproduce (main): 1. Administration > MARC bibliographic framework > BKS > 245 > subfield b: check OPAC, Intranet and Collapsed, uncheck Editor (hidden = -5). 2. Open the MARC tab (catalogue/MARCdetail.pl) of a BKS record that has a 245$b, e.g. biblionumber 1 in the sample data. 3. 245$b is not shown. With hidden = 0 it is. Expected: a subfield is hidden from the staff MARC view only when its "Intranet" box is not checked (-8, -7, -4, -3, -2, 2, 3, 5, 8). Reproduced on main (c8e8025). -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 --- Comment #1 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 212595 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212595&action=edit Bug 44284: Anchor the hidden test in the staff MARC view Bug 44284: Anchor the hidden test in the staff MARC view MARCdetail.pl tested the subfield visibility with an unanchored regular expression, so -5 (OPAC, Intranet and Collapsed checked) matched "5" and the subfield was hidden in the staff interface. The same test was used for control fields and item subfields. The values hidden in the staff interface (Intranet not checked) are now matched exactly: -8, -7, -4, -3, -2, 2, 3, 5, 8. Test plan: 1. Administration > MARC bibliographic framework > BKS > 245 > subfield b: check OPAC, Intranet and Collapsed, uncheck Editor. 2. Open the MARC tab of a BKS record with a 245$b (biblionumber 1 in the sample data): 245$b is missing. 3. Apply the patch, restart Plack, reload: 245$b is shown. 4. Uncheck Intranet for 245$b (hidden = 5): it is hidden again. 5. Set the subfield back to its old settings. Sponsored-by: Koha Solutions -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |babarjunaid1122@gmail.com |ity.org | Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Good catch. How annoying... Can you look up what commit introduced that change and then link to the applicable bug report via the "Depends on" field? I think it was a fairly recent change from memory. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #2)
Good catch. How annoying...
Can you look up what commit introduced that change and then link to the applicable bug report via the "Depends on" field? I think it was a fairly recent change from memory.
Then again... this one bothered me so much that I decided to look myself and it looks like it dates back to 2009... but I'm sure I saw a bug report about MARCdetail.pl recently... so this might be a duplicate... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 --- Comment #4 from David Cook <dcook@prosentient.com.au> --- Initially I wasn't sure about the inclusion of -8 but it does seem that "Flagged" is supposed to mean hidden in all interfaces as per some comments on bug 9894 and some other places on the internet -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 --- Comment #5 from David Cook <dcook@prosentient.com.au> --- If we look at opac/opac-MARCdetail.pl we can see this line: next if ( $tagslib->{ $fields[$x_i]->tag() }->{'@'}->{hidden} > 0 ); While 1-8 are !OPAC technically it seems that -8 should also be hidden actually. But... that would be a breaking change. I think it's OK that -8 is added for the staff side though since that's easier to change / more meaningful than the OPAC visibility. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |In Discussion --- Comment #6 from David Cook <dcook@prosentient.com.au> --- But you know what... I think the problem is actually not so much with the incorrect "next" condition. Rather, it's with this line: my $record = $biblio_object ? $biblio_object->metadata_record( { embed_items => 1 } ) : undef; We should be specifying the "interface" here so that the Koha::Filter::ViewPolicy filter is added which takes care of the filtering. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 --- Comment #7 from babar junaid <babarjunaid1122@gmail.com> --- Thanks David, that is a better fix. You are right that the record should go through ViewPolicy. catalogue/ISBDdetail.pl already does this with metadata_record( { embed_items => 1, interface => 'intranet' } ), and the intranet list in Koha::Filter::MARC::ViewPolicy (-8, -7, -4, -3, -2, 2, 3, 5, 8) is exactly the set I matched by hand. EmbedItems runs before ViewPolicy, so the item subfields are filtered too. The three regular expression checks in MARCdetail.pl can then be removed instead of fixed, so there is one place that decides what the staff interface hides. I'll attach a reworked patch along those lines, with a test, and obsolete the current one. On a duplicate: the closest I found is bug 8331 (hidden subfields still shown in the staff normal view and plain MARC view). That is the opposite case, too little hidden rather than too much, on other pages, so I don't think this duplicates it. I'll add it to See Also. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=8331 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 --- Comment #8 from David Cook <dcook@prosentient.com.au> --- (In reply to babar junaid from comment #7)
Thanks David, that is a better fix.
You are right that the record should go through ViewPolicy. catalogue/ISBDdetail.pl already does this with metadata_record( { embed_items => 1, interface => 'intranet' } ), and the intranet list in Koha::Filter::MARC::ViewPolicy (-8, -7, -4, -3, -2, 2, 3, 5, 8) is exactly the set I matched by hand. EmbedItems runs before ViewPolicy, so the item subfields are filtered too. The three regular expression checks in MARCdetail.pl can then be removed instead of fixed, so there is one place that decides what the staff interface hides.
I'll attach a reworked patch along those lines, with a test, and obsolete the current one.
On a duplicate: the closest I found is bug 8331 (hidden subfields still shown in the staff normal view and plain MARC view). That is the opposite case, too little hidden rather than too much, on other pages, so I don't think this duplicates it. I'll add it to See Also.
Perfect. Thanks for that! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 --- Comment #9 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 212597 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212597&action=edit Bug 44284: Add tests for Koha::Biblio->metadata_record Bug 44284: Add tests for Koha::Biblio->metadata_record metadata_record had no tests of its own. These cover the interface filtering (a -5 subfield is kept in the staff interface, a 5 subfield is removed, embedded item subfields are filtered too) and the new frameworkcode parameter. Test plan: 1. prove t/db_dependent/Koha/Biblio.t 2. Without the next patch, the frameworkcode tests fail. Sponsored-by: Koha Solutions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 --- Comment #10 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 212598 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212598&action=edit Bug 44284: Use ViewPolicy to hide subfields in the staff MARC view Bug 44284: Use ViewPolicy to hide subfields in the staff MARC view MARCdetail.pl loaded the record without an interface, so the ViewPolicy filter was not applied, and it hid subfields itself with an unanchored regular expression. -5 (OPAC, Intranet and Collapsed checked) matched "5" and the subfield was hidden in the staff interface. The record is now loaded with interface => 'intranet', as ISBDdetail.pl already does, and the three regular expression checks are removed. ViewPolicy's staff list (-8, -7, -4, -3, -2, 2, 3, 5, 8) decides what is hidden, for control fields, data fields and embedded item fields. The MARC view can be shown with another framework (the "With framework" menu, ?frameworkcode=). So that the chosen framework's visibility is still used, metadata_record gets an optional frameworkcode parameter, defaulting to the record's own framework. Test plan: 1. Administration > MARC bibliographic framework: - BKS > 245 > subfield b: check OPAC, Intranet and Collapsed, uncheck Editor (hidden = -5) - BKS > 245 > subfield c: uncheck Intranet (hidden = 5) - Default > 245 > subfield b: uncheck Intranet (hidden = 5) 2. Open the MARC tab of biblionumber 1 (BKS) in the sample data: 245$b and 245$c are both missing. 3. Apply the patches, restart Plack, reload: - 245$b is shown, 245$c is not 4. Pick Default in the "With framework" menu: 245$b is hidden, 245$c is shown. 5. prove t/db_dependent/Koha/Biblio.t t/db_dependent/Filter_MARC_ViewPolicy.t 6. Set the subfields back to their old settings. Sponsored-by: Koha Solutions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44284 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #212595|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org