use C4::Koha;
+=pod
+
+To use, first, include the line '[% USE AuthorisedValues %]' at the top
+of the template to enable the plugin.
+
+Now, in a template, you can get the description for an authorised value with
+the following TT code: [% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VALUE_CODE', 'IS_OPAC' ) %]
+
+The parameters are identical to those used by the subroutine C4::Koha::GetAuthorisedValueByCode.
+
+=cut
+
sub GetByCode {
my ( $self, $category, $code, $opac ) = @_;
return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) );
+++ /dev/null
-package Koha::Template::Plugin::KohaAuthorisedValues;
-
-# Copyright ByWater Solutions 2012
-
-# 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 authorised value
-from within a template.
-
-First, include the line '[% USE KohaAuthorisedValues %]' at the top
-of the template to enable the plugin.
-
-To use, call KohaAuthorisedValues.GetByCode with the category
-of the authorised value, the code to look up, and optionally,
-the OPAC flag ( if set, it will return the OPAC description rather
-than the Intranet description ).
-
-For example: [% KohaAuthorisedValues.GetByCode( 'LOST', item.itemlost, 1 ) %]
-will print the OPAC description for the LOST value stored in item.itemlost.
-
-=cut
-
-sub GetByCode {
- my ( $self, $category, $code, $opac ) = @_;
- return GetAuthorisedValueByCode( $category, $code, $opac );
-}
-
-1;
[% IF ( export_remove_fields OR export_with_csv_profile ) %]
[% SET exports_enabled = 1 %]
[% END %]
-[% USE KohaAuthorisedValues %]
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
[% SET destination = "circ" %]
<title>Koha › Circulation
[% IF ( itemtype_notforloan ) %]
Item type is normally not for loan.
[% ELSIF ( item_notforloan ) %]
- [% item_notforloan_lib = KohaAuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
+ [% item_notforloan_lib = AuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
Item is normally not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
[% END %]
Check out anyway?
[% IF ( itemtype_notforloan ) %]
Item type not for loan.
[% ELSIF ( item_notforloan ) %]
- [% item_notforloan_lib = KohaAuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
+ [% item_notforloan_lib = AuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
Item not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
[% END %]
</li>
<span title="[% todayissue.dd_sort %]">[% todayissue.dd %]</span>
[% IF ( todayissue.itemlost ) %]
- <span class="lost">[% KohaAuthorisedValues.GetByCode( 'LOST', todayissue.itemlost ) %]</span>
+ <span class="lost">[% AuthorisedValues.GetByCode( 'LOST', todayissue.itemlost ) %]</span>
[% END %]
[% IF ( todayissue.damaged ) %]
- <span class="dmg">[% KohaAuthorisedValues.GetByCode( 'DAMAGED', todayissue.damaged ) %]</span>
+ <span class="dmg">[% AuthorisedValues.GetByCode( 'DAMAGED', todayissue.damaged ) %]</span>
[% END %]
</td>
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% todayissue.biblionumber %]&type=intra"><strong>[% todayissue.title |html %][% FOREACH subtitl IN todayissue.subtitle %] [% subtitl.subfield %][% END %]</strong></a>[% IF ( todayissue.author ) %], by [% todayissue.author %][% END %][% IF ( todayissue.itemnotes ) %]- <span class="circ-hlt">[% todayissue.itemnotes %]</span>[% END %] <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% todayissue.biblionumber %]&itemnumber=[% todayissue.itemnumber %]#item[% todayissue.itemnumber %]">[% todayissue.barcode %]</a></td>
<span title="[% previssue.dd_sort %]">[% previssue.dd %]</span>
[% IF ( previssue.itemlost ) %]
- <span class="lost">[% KohaAuthorisedValues.GetByCode( 'LOST', previssue.itemlost ) %]</span>
+ <span class="lost">[% AuthorisedValues.GetByCode( 'LOST', previssue.itemlost ) %]</span>
[% END %]
[% IF ( previssue.damaged ) %]
- <span class="dmg">[% KohaAuthorisedValues.GetByCode( 'DAMAGED', previssue.damaged ) %]</span>
+ <span class="dmg">[% AuthorisedValues.GetByCode( 'DAMAGED', previssue.damaged ) %]</span>
[% END %]
</td>
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% previssue.biblionumber %]&type=intra"><strong>[% previssue.title |html %][% FOREACH subtitl IN previssue.subtitle %] [% subtitl.subfield %][% END %]</strong></a>[% IF ( previssue.author ) %], by [% previssue.author %][% END %] [% IF ( previssue.itemnotes ) %]- [% previssue.itemnotes %][% END %] <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% previssue.biblionumber %]&itemnumber=[% previssue.itemnumber %]#item[% previssue.itemnumber %]">[% previssue.barcode %]</a></td>
<span title="[% relissue.dd_sort %]">[% relissue.dd %]</span></td>
[% IF ( relissue.itemlost ) %]
- <span class="lost">[% KohaAuthorisedValues.GetByCode( 'LOST', relissue.itemlost ) %]</span>
+ <span class="lost">[% AuthorisedValues.GetByCode( 'LOST', relissue.itemlost ) %]</span>
[% END %]
[% IF ( relissue.damaged ) %]
- <span class="dmg">[% KohaAuthorisedValues.GetByCode( 'DAMAGED', relissue.damaged ) %]</span>
+ <span class="dmg">[% AuthorisedValues.GetByCode( 'DAMAGED', relissue.damaged ) %]</span>
[% END %]
</td>
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% relissue.biblionumber %]&type=intra"><strong>[% relissue.title |html %][% FOREACH subtitl IN relissue.subtitle %] [% subtitl.subfield %][% END %]</strong></a>[% IF ( relissue.author ) %], by [% relissue.author %][% END %][% IF ( relissue.itemnotes ) %]- <span class="circ-hlt">[% relissue.itemnotes %]</span>[% END %] <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% relissue.biblionumber %]&itemnumber=[% relissue.itemnumber %]#item[% relissue.itemnumber %]">[% relissue.barcode %]</a></td>
-[% USE KohaAuthorisedValues %]
[% USE Branches %]
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions ›
[% IF ( op_save ) %]
[% ELSE %][% suggestion.suggestiontypelabel %][% END %]
[% ELSE %]
[% IF ( suggestion.suggestiontype ) %]
- [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
+ [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
[% ELSE %]
No name
[% END %]
Rejected
[% ELSIF ( suggestions_loo.CHECKED ) %]
Checked
- [% ELSIF KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
- [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
+ [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
+ [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
[% END %]
[% IF ( suggestions_loo.reason ) %]
-[% USE KohaAuthorisedValues %]
+[% USE AuthorisedValues %]
[%#-
This include takes two parameters: an item structure
[% ELSIF ( item.notforloan_per_itemtype ) %]
Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
[% ELSIF ( item.damaged ) %]
- [% av_lib_include = KohaAuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %]
+ [% av_lib_include = AuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %]
[% IF av_lib_include %]
[% av_lib_include %]
[% ELSE %]
[% USE Koha %]
-[% USE KohaAuthorisedValues %]
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog ›
[% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
[% IF ( op_else ) %]Purchase Suggestions[% END %]
[% ELSIF ( suggestions_loo.ORDERED ) %]Ordered by the library
[% ELSIF ( suggestions_loo.REJECTED ) %]Suggestion declined
[% ELSIF ( suggestions_loo.AVAILABLE ) %]Available in the library
- [% ELSE %] [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) %] [% END %]
+ [% ELSE %] [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) %] [% END %]
[% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason |html %])[% END %]
</td>