<<

NAME

Koha::Filter::MARC::ViewPolicy - this filters a MARC record.

VERSION

version 1.0

SYNOPSIS

my $processor = Koha::RecordProcessor->new( { filters => ('ViewPolicy') } );

DESCRIPTION

Filter to remove fields based on the 'Advance constraints' settings found when editing a particular subfield definition of a MARC bibliographic framework found under the Koha administration menu.

SUBROUTINES/METHODS

filter

    my $processor = Koha::RecordProcessor->new( { filters => ('ViewPolicy') } );
...
    my $newrecord = $processor->filter($record);
    my $newrecords = $processor->filter(\@records);

This returns a filtered copy of the record based on the Advanced constraints visibility settings.

should_hide_marc

Return a hash reference of whether a field, built from kohafield and tag, is hidden (1) or not (0) for a given interface

  my $OpacHideMARC =
    should_hide_marc( {
                        frameworkcode => $frameworkcode,
                        interface     => 'opac',
                      } );

  if ($OpacHideMARC->{'stocknumber'}==1) {
       print "Hidden!\n";
  }

$OpacHideMARC is a ref to a hash which contains a series of key value pairs indicating if that field (key) is hidden (value == 1) or not (value == 0).

$frameworkcode is the framework code.

$interface is the interface. It defaults to 'opac' if nothing is passed. Valid values include 'opac' or 'intranet'.

DIAGNOSTICS

 $ prove -v t/RecordProcessor.t
 $ prove -v t/db_dependent/Filter_MARC_ViewPolicy.t

CONFIGURATION AND ENVIRONMENT

Install Koha. This filter will be used appropriately by the OPAC or staff interface.

INCOMPATIBILITIES

This is designed for MARC::Record filtering currently. It will not handle MARC::MARCXML.

DEPENDENCIES

The following Perl libraries are required: Modern::Perl and Carp. The following Koha libraries are required: C4::Biblio, Koha::RecordProcessor, and Koha::RecordProcessor::Base. These should all be installed if the koha-common package is installed or Koha is otherwise installed.

BUGS AND LIMITATIONS

This is the initial version. Please feel free to report bugs at http://bugs.koha-community.org/.

AUTHOR

Mark Tompsett

LICENSE AND COPYRIGHT

Copyright 2015 Mark Tompsett

This file is part of Koha.

Koha is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

Koha is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Koha; if not, see <http://www.gnu.org/licenses>.

<<