@@ -, +, @@ --- Koha/Template/Plugin/KohaItemType.pm | 44 ++++++++++++++++++++ .../intranet-tmpl/prog/en/modules/acqui/ordered.tt | 5 ++- .../intranet-tmpl/prog/en/modules/acqui/spent.tt | 5 ++- 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 Koha/Template/Plugin/KohaItemType.pm --- a/Koha/Template/Plugin/KohaItemType.pm +++ a/Koha/Template/Plugin/KohaItemType.pm @@ -0,0 +1,44 @@ +package Koha::Template::Plugin::KohaItemType; + +# This file is part of Koha. +# +# 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 +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; +use Template::Plugin; +use base qw( Template::Plugin ); + +use C4::Koha; + +=pod + +This plugin allows one to get the description for an item type from within a template. + +First, include the line '[% USE KohaItemType %]' at the top +of the template to enable the plugin. + +To use, call KohaItemType.GetByCode with the code of the item type. + +For example: [% KohaItemType.GetByCode( 'CF' ) %] +will print the OPAC description for the CF value stored in itemtypes.description. + +=cut + +sub GetByCode { + my ( $self, $code ) = @_; + my $itemtype = getitemtypeinfo( $code ); + return $itemtype->{description}; +} + +1; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE KohaItemType %] [% INCLUDE 'doc-head-open.inc' %]