[Koha-patches] [PATCH] [SIGNED-OFF] Bug 10090: Add itemtype description instead of code

Srdjan srdjan at catalyst.net.nz
Mon Jun 3 07:32:53 CEST 2013


From: Jonathan Druart <jonathan.druart at biblibre.com>

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 <srdjan at catalyst.net.nz>
---
 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' %]
 <title>Koha › Acquisitions › Ordered</title>
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
@@ -59,7 +60,7 @@
 	</td>
 	<td class="cell">
         [% IF ( CAN_user_acquisition_order_manage ) %]
-            <a href="/cgi-bin/koha/acqui/neworderempty.pl?ordernumber=[% order.ordernumber %]&booksellerid=[% order.booksellerid %]&basketno=[% order.basketno %]">[% order.ordernumber %]</a>
+            <a href="/cgi-bin/koha/acqui/orderreceive.pl?ordernumber=[% order.ordernumber %]&biblio=[% order.biblionumber %]&invoiceid=[% order.invoiceid %]">[% order.ordernumber %]</a>
         [% ELSE %]
             [% order.ordernumber %]
         [% END %]
@@ -68,7 +69,7 @@
 	    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.booksellerid %]">[% order.booksellerid %]</a>
 	</td>
 	<td class="cell">
-	    [% order.itype %]
+        [% KohaItemType.GetByCode( order.itype ) %]
 	</td>
 	<td class="cell">
 	    [% 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' %]
 <title>Koha › Acquisitions › Spent</title>
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
@@ -62,7 +63,7 @@
 	    [% order.title %]
 	</td>
 	<td class="cell">
-            <a href="/cgi-bin/koha/acqui/orderreceive.pl?ordernumber=[% order.ordernumber %]&biblio=[% order.biblionumber %]&invoiceid=[% order.invoiceid %]">[% order.ordernumber %]</a>
+        [% order.ordernumber %]
 	</td>
 	<td class="cell">
 	    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.booksellerid %]">[% order.booksellerid %]</a>
@@ -71,7 +72,7 @@
 	    <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid %]">[% order.invoicenumber %]</a>
 	</td>
 	<td class="cell">
-	    [% order.itype %]
+        [% KohaItemType.GetByCode( order.itype ) %]
 	</td>
 	<td class="cell">
 	    [% order.quantityreceived %]
-- 
1.8.1.2



More information about the Koha-patches mailing list