<<

NAME

Koha::Object::Mixin::AdditionalFields

SYNOPSIS

    package Koha::Foo;

    use parent qw( Koha::Object Koha::Object::Mixin::AdditionalFields );

    sub _type { 'Foo' }


    package main;

    use Koha::Foo;

    Koha::Foos->find($id)->set_additional_fields(...);

API

Public methods

set_additional_fields

    $foo->set_additional_fields([
        {
            id => 1,
            value => 'foo',
        },
        {
            id => 2,
            value => 'bar',
        }
    ]);

prepare_cgi_additional_field_values

Prepares additional field values from CGI input for use in set_additional_fields

    Usage example for aqorders:
    my @additional_fields = $order->prepare_cgi_additional_field_values( $input, 'aqorders' );

add_additional_fields

Similar to set_additional_fields, but instead of overwriting existing fields, only adds new ones

    $foo->add_additional_fields(
        {
            '2' => [
                'first value for field 2',
                'second value for field 2'
            ],
            '1' => ['first value for field 1']
        },
        'subscription'
    );

get_additional_field_values_for_template

Returns additional field values in the format expected by the .tt file

    my $fields =  Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template;

Expected format is a hash of arrays, where the hash key is the field id and its respective array contains the field values 'value' for that field. Example where field_id = 2 is the only repeatable field:

{ '3' => ['first value for field 3'], '1' => ['first value for field 1'], '4' => ['first value for field 4'], '2' => [ 'first value for field 2', 'second value for field 2', 'third value for field 2' ] };

additional_field_values

Returns additional field values

    my @values = $foo->additional_field_values;

extended_attributes

REST API embed of additional_field_values

strings_map

Returns a map of column name to string representations including the string, the mapping type and the mapping category where appropriate.

Currently handles additional fields values mappings.

Accepts a param hashref where the 'public' key denotes whether we want the public or staff interface strings.

AUTHOR

Koha Development Team <http://koha-community.org/>

COPYRIGHT AND LICENSE

Copyright 2018 BibLibre

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>.

<<