View | Details | Raw Unified | Return to bug 766
Collapse All | Expand All

(-)a/Koha/Template/Plugin/AuthorisedValues.pm (-30 / +50 lines)
Lines 1-22 Link Here
1
package Koha::Template::Plugin::AuthorisedValues;
1
package Koha::Template::Plugin::AuthorisedValues;
2
2
3
# Copyright ByWater Solutions 2012
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
3
use Modern::Perl;
21
4
22
use Template::Plugin;
5
use Template::Plugin;
Lines 27-44 use Encode qw{encode decode}; Link Here
27
use C4::Koha;
10
use C4::Koha;
28
use C4::Charset;
11
use C4::Charset;
29
12
30
=pod
31
32
To use, first, include the line '[% USE AuthorisedValues %]' at the top
33
of the template to enable the plugin.
34
35
Now, in a template, you can get the description for an authorised value with
36
the following TT code: [% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VALUE_CODE', 'IS_OPAC' ) %]
37
38
The parameters are identical to those used by the subroutine C4::Koha::GetAuthorisedValueByCode.
39
40
=cut
41
42
sub GetByCode {
13
sub GetByCode {
43
    my ( $self, $category, $code, $opac ) = @_;
14
    my ( $self, $category, $code, $opac ) = @_;
44
    return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) );
15
    return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) );
Lines 50-52 sub GetAuthValueDropbox { Link Here
50
}
21
}
51
22
52
1;
23
1;
53
- 
24
25
=head1 NAME
26
27
Koha::Template::Plugin::AuthorisedValues - TT Plugin for authorised values
28
29
=head1 SYNOPSIS
30
31
[% USE AuthorisedValues %]
32
33
[% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VALUE_CODE', 'IS_OPAC' ) %]
34
35
[% AuthorisedValues.GetAuthValueDropbox( $category, $default ) %]
36
37
=head1 ROUTINES
38
39
=head2 GetByCode
40
41
In a template, you can get the description for an authorised value with
42
the following TT code: [% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VALUE_CODE', 'IS_OPAC' ) %]
43
44
The parameters are identical to those used by the subroutine C4::Koha::GetAuthorisedValueByCode.
45
46
=head2 GetAuthValueDropbox
47
48
The parameters are identical to those used by the subroutine C4::Koha::GetAuthValueDropbox
49
50
=head1 AUTHOR
51
52
Kyle M Hall <kyle@bywatersolutions.com>
53
54
Jonathan Druart <jonathan.druart@biblibre.com>
55
56
=head1 COPYRIGHT
57
58
Copyright ByWater Solutions 2012
59
60
Copyright BibLibre 2013
61
62
=head1 LICENSE
63
64
This file is part of Koha.
65
66
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
67
Foundation; either version 3 of the License, or (at your option) any later version.
68
69
You should have received a copy of the GNU General Public License along
70
with Koha; if not, write to the Free Software Foundation, Inc.,
71
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
72
73
=cut

Return to bug 766