Bug 10626: Remove doubled up TT plugins - Merge KohaAuthorisedValues and AuthorisedValues
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 19 Dec 2013 17:13:23 +0000 (12:13 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 20 Dec 2013 04:14:45 +0000 (04:14 +0000)
This patch removes the KohaAuthorisedValues TT plugin; uses of it are
replaced by the AuthorisedValues plugin, which does the same thing.

Test Plan:
1) Apply this patch
2) View the pages that this patch has modified, make sure the branch
   name is still visible

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comments on second patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Koha/Template/Plugin/AuthorisedValues.pm
Koha/Template/Plugin/KohaAuthorisedValues.pm [deleted file]
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc
koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt

index 683a0ff..0a19be2 100644 (file)
@@ -26,6 +26,18 @@ use Encode qw{encode decode};
 
 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 ) );
diff --git a/Koha/Template/Plugin/KohaAuthorisedValues.pm b/Koha/Template/Plugin/KohaAuthorisedValues.pm
deleted file mode 100644 (file)
index 68b1347..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-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;
index 3596767..3ecedd8 100644 (file)
@@ -3,7 +3,7 @@
 [% 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 &rsaquo; Circulation
@@ -229,7 +229,7 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
     [% 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?
@@ -362,7 +362,7 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
             [% 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>
@@ -712,10 +712,10 @@ No patron matched <span class="ex">[% message %]</span>
         <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 %]&amp;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 %]&amp;itemnumber=[% todayissue.itemnumber %]#item[% todayissue.itemnumber %]">[% todayissue.barcode %]</a></td>
@@ -799,10 +799,10 @@ No patron matched <span class="ex">[% message %]</span>
         <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 %]&amp;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 %]&amp;itemnumber=[% previssue.itemnumber %]#item[% previssue.itemnumber %]">[% previssue.barcode %]</a></td>
@@ -940,10 +940,10 @@ No patron matched <span class="ex">[% message %]</span>
             <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 %]&amp;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 %]&amp;itemnumber=[% relissue.itemnumber %]#item[% relissue.itemnumber %]">[% relissue.barcode %]</a></td>
index 9f5c40e..cd5b958 100644 (file)
@@ -1,5 +1,5 @@
-[% USE KohaAuthorisedValues %]
 [% USE Branches %]
+[% USE AuthorisedValues %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions  &rsaquo;
     [% IF ( op_save ) %]
@@ -452,7 +452,7 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o
                 [% ELSE %][% suggestion.suggestiontypelabel %][% END %]
             [% ELSE %]
                 [% IF ( suggestion.suggestiontype ) %]
-                    [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
+                    [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
                 [% ELSE %]
                     No name
                 [% END %]
@@ -519,8 +519,8 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o
                         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 ) %]
index 19234f7..ec7304d 100644 (file)
@@ -1,4 +1,4 @@
-[% USE KohaAuthorisedValues %]
+[% USE AuthorisedValues %]
 
 [%#-
 This include takes two parameters: an item structure
@@ -40,7 +40,7 @@ not use an API to fetch items that populates item.datedue.
 [% 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 %]
index 6313259..5e52d84 100644 (file)
@@ -1,5 +1,5 @@
 [% USE Koha %]
-[% USE KohaAuthorisedValues %]
+[% USE AuthorisedValues %]
 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;
 [% 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>