Update release notes for 23.05.12 release
[koha.git] / Koha / AdditionalField.pm
1 package Koha::AdditionalField;
2
3 =head1 NAME
4
5 Koha::AdditionalField - Koha::Object derived class for additional fields
6
7 =cut
8
9 use Modern::Perl;
10
11 use base qw(Koha::Object);
12
13 use C4::Context;
14 use Koha::MarcSubfieldStructures;
15
16 =head1 METHODS
17
18 =head2 effective_authorised_value_category
19
20 Returns the authorised value category of the additional field or the authorised
21 value category of the MARC field, if any.
22
23     my $av_category = $additional_field->effective_authorised_value_category;
24
25 =cut
26
27 sub effective_authorised_value_category {
28     my ($self) = @_;
29
30     my $category = $self->authorised_value_category;
31     unless ($category) {
32         if ($self->marcfield) {
33             my ($tag, $subfield) = split /\$/, $self->marcfield;
34
35             my $mss = Koha::MarcSubfieldStructures->find('', $tag, $subfield);
36             if ($mss) {
37                 $category = $mss->authorised_value;
38             }
39         }
40     }
41
42     return $category;
43 }
44
45 sub _type { 'AdditionalField' }
46
47 =head1 AUTHOR
48
49 Koha Development Team <http://koha-community.org/>
50
51 =head1 COPYRIGHT AND LICENSE
52
53 Copyright 2013, 2018 BibLibre
54
55 This file is part of Koha.
56
57 Koha is free software; you can redistribute it and/or modify it under the
58 terms of the GNU General Public License as published by the Free Software
59 Foundation; either version 3 of the License, or (at your option) any later
60 version.
61
62 Koha is distributed in the hope that it will be useful, but WITHOUT ANY
63 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
64 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
65
66 You should have received a copy of the GNU General Public License along
67 with Koha; if not, see <http://www.gnu.org/licenses>.
68
69 =head1 SEE ALSO
70
71 L<Koha::Object>
72
73 =cut
74
75 1;