1 package Koha
::Object
::Mixin
::AdditionalFields
;
4 use Koha
::AdditionalFieldValues
;
8 Koha::Object::Mixin::AdditionalFields
14 use parent qw( Koha::Object Koha::Object::Mixin::AdditionalFields );
23 Koha::Foos->find($id)->set_additional_fields(...);
29 =head3 set_additional_fields
31 $foo->set_additional_fields([
44 sub set_additional_fields
{
45 my ($self, $additional_fields) = @_;
47 $self->additional_field_values->delete;
49 foreach my $additional_field (@
$additional_fields) {
50 my $value = $additional_field->{value
};
52 my $field_value = Koha
::AdditionalFieldValue
->new({
53 field_id
=> $additional_field->{id
},
54 record_id
=> $self->id,
61 =head3 additional_field_values
63 Returns additional field values
65 my @values = $foo->additional_field_values;
69 sub additional_field_values
{
72 my $afv_rs = $self->_result->additional_field_values;
73 return Koha
::AdditionalFieldValues
->_new_from_dbic( $afv_rs );
78 Koha Development Team <http://koha-community.org/>
80 =head1 COPYRIGHT AND LICENSE
82 Copyright 2018 BibLibre
84 This file is part of Koha.
86 Koha is free software; you can redistribute it and/or modify it under the
87 terms of the GNU General Public License as published by the Free Software
88 Foundation; either version 3 of the License, or (at your option) any later
91 Koha is distributed in the hope that it will be useful, but WITHOUT ANY
92 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
93 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
95 You should have received a copy of the GNU General Public License along
96 with Koha; if not, see <http://www.gnu.org/licenses>.