Bug 16157: Move the selected flag from GetAuthorisedValues to the templates
[koha.git] / Koha / Template / Plugin / AuthorisedValues.pm
1 package Koha::Template::Plugin::AuthorisedValues;
2
3 # Copyright 2012 ByWater Solutions
4 # Copyright 2013-2014 BibLibre
5 #
6 # Koha is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Koha is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Koha; if not, see <http://www.gnu.org/licenses>.
18
19 use Modern::Perl;
20
21 use Template::Plugin;
22 use base qw( Template::Plugin );
23
24 use C4::Koha;
25
26 sub GetByCode {
27     my ( $self, $category, $code, $opac ) = @_;
28     return GetAuthorisedValueByCode( $category, $code, $opac );
29 }
30
31 sub Get {
32     my ( $self, $category, $opac ) = @_;
33     return GetAuthorisedValues( $category, $opac );
34 }
35
36 sub GetAuthValueDropbox {
37     my ( $self, $category, $default ) = @_;
38     return C4::Koha::GetAuthvalueDropbox($category, $default);
39 }
40
41 1;
42
43 =head1 NAME
44
45 Koha::Template::Plugin::AuthorisedValues - TT Plugin for authorised values
46
47 =head1 SYNOPSIS
48
49 [% USE AuthorisedValues %]
50
51 [% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VALUE_CODE', 'IS_OPAC' ) %]
52
53 [% AuthorisedValues.GetAuthValueDropbox( $category, $default ) %]
54
55 =head1 ROUTINES
56
57 =head2 GetByCode
58
59 In a template, you can get the description for an authorised value with
60 the following TT code: [% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VALUE_CODE', 'IS_OPAC' ) %]
61
62 The parameters are identical to those used by the subroutine C4::Koha::GetAuthorisedValueByCode.
63
64 sub GetByCode {
65     my ( $self, $category, $code, $opac ) = @_;
66     return GetAuthorisedValueByCode( $category, $code, $opac );
67 }
68
69 =head2 GetAuthValueDropbox
70
71 The parameters are identical to those used by the subroutine C4::Koha::GetAuthValueDropbox
72
73 =head1 AUTHOR
74
75 Kyle M Hall <kyle@bywatersolutions.com>
76
77 Jonathan Druart <jonathan.druart@biblibre.com>
78
79 =cut