Line 0
Link Here
|
|
|
1 |
package Koha::Template::Plugin::KohaItemType; |
2 |
|
3 |
# This file is part of Koha. |
4 |
# |
5 |
# Koha is free software; you can redistribute it and/or modify it under the |
6 |
# terms of the GNU General Public License as published by the Free Software |
7 |
# Foundation; either version 2 of the License, or (at your option) any later |
8 |
# version. |
9 |
# |
10 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
11 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
12 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
13 |
# |
14 |
# You should have received a copy of the GNU General Public License along |
15 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
16 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
17 |
|
18 |
use Modern::Perl; |
19 |
use Template::Plugin; |
20 |
use base qw( Template::Plugin ); |
21 |
|
22 |
use C4::Koha; |
23 |
|
24 |
=pod |
25 |
|
26 |
This plugin allows one to get the description for an item type from within a template. |
27 |
|
28 |
First, include the line '[% USE KohaItemType %]' at the top |
29 |
of the template to enable the plugin. |
30 |
|
31 |
To use, call KohaItemType.GetByCode with the code of the item type. |
32 |
|
33 |
For example: [% KohaItemType.GetByCode( 'CF' ) %] |
34 |
will print the OPAC description for the CF value stored in itemtypes.description. |
35 |
|
36 |
=cut |
37 |
|
38 |
sub GetByCode { |
39 |
my ( $self, $code ) = @_; |
40 |
my $itemtype = getitemtypeinfo( $code ); |
41 |
return $itemtype->{description}; |
42 |
} |
43 |
|
44 |
1; |