[Koha-bugs] [Bug 11592] opac detail scripts do not respect MARC tag visibility

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Sep 4 02:31:07 CEST 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11592

M. Tompsett <mtompset at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #28724|0                           |1
        is obsolete|                            |

--- Comment #47 from M. Tompsett <mtompset at hotmail.com> ---
Created attachment 31356
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=31356&action=edit
Bug 11592 - MARC Visibility settings not respected

The advanced constraints section while editing subfield
structure for a particular MARC bibliographic framework allow
the user to set visibility settings for OPAC and Intranet.

These settings are not fully respected. This was first
discovered while comparing the information displayed on
the opac-MARCdetail and opac-detail pages. To this end,
this patch will provide the ability to correct this problem
across the board as desired, but will focus primarily on the
OPAC interface.

This was accomplished by adding 3 functions to C4/Biblio.pm:
- ShouldDisplayOnInterface
- ShouldHideMARC
- GetFilteredBiblio
And also by modifying GetMarcBiblio to filter or not based on
parameter style and parameter values passed.

ShouldDisplayOnInterface is a wrapper routine which just
returns a hash of hashes which let us know if something is
visible (1) or not (0 or undef) for a given interface (opac
or intranet). This allows us to add/remove to the advance
constraints section and then not have to update multiple
routines to keep the filtering working properly, though if it
is a drastic refactoring that would be necessary.

ShouldHideMARC takes a field from marc_subfield_structure,
and determines if it should be hidden. It does this for
all the fields for a given framework code on a particular
interface. If no framework code is given, the framework
code used is the default one. If not interface is specified,
OPAC is assumed. This routine returns a hash reference to the
corresponding hash that was built.

GetFilteredBiblio takes a MARC::Record, clones it, and then
strips all the fields that should not be visible for a given
framework code and interface. If no framework code is specied,
it assumes the default one. If no interface is given, OPAC is
assumed. The routine then returns the filtered record.

GetMarcBiblio was modified to accept a hash style
parameter. This allowed for filtering if the new convention
was used, and no apparent change if the old convention is used.

These functions allowed for filtering, but frequently there were
problems with titles, subjects, etc. This required other tweaks.
In C4/Biblio.pm, GetMarcSubjects was returning the subject,
even it was supposed to be hidden. C4/XSLT.pm tried to replace
a field with no field, rather than properly delete it.

With the filtering being implemented based on the parameter
style, it just required a minor tweak in opac-ISDBdetail to
filter. The title needed to be purposefully not set if it was
supposed to be hidden in opac-MARCdetail.

However, opac-detail was interesting challenge. First, changing
the parameter style did filtering, but the output still was
leaking things which should be hidden. This is the main reason
ShouldHideMARC was written, because there is an insidious
little loop that runs through a set of keys and sets template
parameters to values.

Second, By skipping to the next key based on the hash ref
returned by ShouldHideMARC, the template parameter is not set,
and thus the value is properly hidden.

Third, the subtitle was grabbed by GetRecordValue. This was
refactored so filtering worked properly.

Then opac-MARCdetail's 'view plain' was still showing details.
This required converting the XML record to a MARC::Record,
filtering it, and then converting it back.

By tweaking opac-export and opac-showmarc to use the new
parameter calling convention, records were filtered properly.

And of course, with modifications and additions to C4/Biblio.pm,
tests were required.

t/Biblio.t has been modified to check the new function
ShouldDisplayOnInterface.

t/db_dependent/Biblio.t has also been modified. It confirms
that both old and new calling conventions work. It also tests
hiding the title field (200$a UNIMARC, 245$a MARC). It includes
tests for ShouldHideMARC, GetFilteredBiblio, and GetMarcBiblio.

TEST PLAN
---------
 1) Back up your DB
 2) Go to any OPAC detail page and note the biblio number.
 3) Log into the staff client and determine the framework code for
     that biblio number.
 4) The steps should be done with OPACXSLTDetailsDisplay
     set to blank.
 5) Home -> Koha administration -> MARC bibliographic framework
         -> MARC structure (for the matching framework)
 6) On the OPAC detail page, click MARC view
 7) In the staff client, for every tag listed in the OPAC
     -> Subfields -> click the first link
     Then running through all the tabs, click Advanced constraints
      and uncheck OPAC visibility. Then click Save Changes
 8) Refresh the opac-MARCdetail page in OPAC
    -- what you hid should be mostly hidden
       TITLE will still display, even if you hide 245$a!
 9) Click Normal view, and all the hidden things are still
     mostly showing!
10) The steps should be done with OPACXSLTDetailsDisplay
    set to default (or some custom one?).
11) Refresh the opac-detail page. Still mostly showing all the
     hidden things.
12) Click MARC view, and everything should be mostly hidden as
     before until you...
13) Click the 'view plain' link.
14) Apply the patch.
15) Run the Koha QA test tool.
16) perldoc C4::Biblio
   -- Look for ShouldHideMARC and confirm that the perldoc
      entries are okay.
17) prove -v t/Biblio.t
   -- 'Visibility values confirmed.' test should pass.
18) prove -v t/db_dependent/Biblio.t
   -- tests 26 through 41 should pass for UNIMARC and MARC21.
      It would be good to test this patch on both types of
      systems.
19) Refresh the opac-MARCdetail page. Title should hide now.
20) Click the 'view plain' link.
    -- LDR and 999$c and 999$d were displaying for me.
       I realized that I hadn't hidden 999, because the
       opac-MARCdetail page doesn't display it.
       LDR is the only known leak.
21) Click Normal view
22) Now all the opac-detail page should hide things just like
     the opac-MARCdetail page.
23) In the staff client, change the OPACXSLTDetailsDisplay to
     a blank value.
24) Recheck opac-detail and opac-MARC detail pages again,
     including the view plain link, and everything should
     hidden similarly.
    -- NOTE: LDR is the only known leak.
NOTE: 952 fields do hide in 'MARC view', but not normal view.
      This patch does not deal with 952 fields.
25) Attempt to 'Save record' in a variety of types.
    -- Only unhidden fields should display.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list