From d1fc940cb0af83cdd1f9732ea63a24b7d8056917 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 4 Apr 2013 12:09:37 +0200 Subject: [PATCH] [SIGNED-OFF] Bug 10090: Add itemtype description instead of code On ordered.pl and spent.pl, the itemtype codes are displayed, instead of descriptions. Links for the ordernumber should be changed. In ordered.pl, we are redirected to the receive page. In spent.pl, the links are deleted. Signed-off-by: Srdjan --- 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 diff --git a/Koha/Template/Plugin/KohaItemType.pm b/Koha/Template/Plugin/KohaItemType.pm new file mode 100644 index 0000000..efa3da3 --- /dev/null +++ b/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; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt index 23441f8..56ce1ce 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE KohaItemType %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › Ordered @@ -59,7 +60,7 @@ [% IF ( CAN_user_acquisition_order_manage ) %] - [% order.ordernumber %] + [% order.ordernumber %] [% ELSE %] [% order.ordernumber %] [% END %] @@ -68,7 +69,7 @@ [% order.booksellerid %] - [% order.itype %] + [% KohaItemType.GetByCode( order.itype ) %] [% order.left %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt index 95634d0..8e7b6b5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE KohaItemType %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › Spent @@ -62,7 +63,7 @@ [% order.title %] - [% order.ordernumber %] + [% order.ordernumber %] [% order.booksellerid %] @@ -71,7 +72,7 @@ [% order.invoicenumber %] - [% order.itype %] + [% KohaItemType.GetByCode( order.itype ) %] [% order.quantityreceived %] -- 1.8.1.2