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

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon May 26 16:31:56 CEST 2014


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

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

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

--- Comment #36 from M. Tompsett <mtompset at hotmail.com> ---
Created attachment 28477
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=28477&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.

Next, opac-export and opac-showmarc were tweaked to use the new
parameter calling convention to filter 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
---------

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


More information about the Koha-bugs mailing list