View | Details | Raw Unified | Return to bug 10626
Collapse All | Expand All

(-)a/Koha/Template/Plugin/AuthorisedValues.pm (+12 lines)
Lines 26-31 use Encode qw{encode decode}; Link Here
26
26
27
use C4::Koha;
27
use C4::Koha;
28
28
29
=pod
30
31
To use, first, include the line '[% USE AuthorisedValues %]' at the top
32
of the template to enable the plugin.
33
34
Now, in a template, you can get the description for an authorised value with
35
the following TT code: [% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VALUE_CODE', 'IS_OPAC' ) %]
36
37
The parameters are identical to those used by the subroutine C4::Koha::GetAuthorisedValueByCode.
38
39
=cut
40
29
sub GetByCode {
41
sub GetByCode {
30
    my ( $self, $category, $code, $opac ) = @_;
42
    my ( $self, $category, $code, $opac ) = @_;
31
    return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) );
43
    return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) );
(-)a/Koha/Template/Plugin/KohaAuthorisedValues.pm (-50 lines)
Lines 1-50 Link Here
1
package Koha::Template::Plugin::KohaAuthorisedValues;
2
3
# Copyright ByWater Solutions 2012
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Template::Plugin;
23
use base qw( Template::Plugin );
24
25
use C4::Koha;
26
27
=pod
28
29
This plugin allows one to get the description for an authorised value
30
from within a template.
31
32
First, include the line '[% USE KohaAuthorisedValues %]' at the top
33
of the template to enable the plugin.
34
35
To use, call KohaAuthorisedValues.GetByCode with the category
36
of the authorised value, the code to look up, and optionally,
37
the OPAC flag ( if set, it will return the OPAC description rather
38
than the Intranet description ).
39
40
For example: [% KohaAuthorisedValues.GetByCode( 'LOST', item.itemlost, 1 ) %]
41
will print the OPAC description for the LOST value stored in item.itemlost.
42
43
=cut
44
45
sub GetByCode {
46
    my ( $self, $category, $code, $opac ) = @_;
47
    return GetAuthorisedValueByCode( $category, $code, $opac );
48
}
49
50
1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-9 / +9 lines)
Lines 3-9 Link Here
3
[% IF ( export_remove_fields OR export_with_csv_profile ) %]
3
[% IF ( export_remove_fields OR export_with_csv_profile ) %]
4
   [% SET exports_enabled = 1 %]
4
   [% SET exports_enabled = 1 %]
5
[% END %]
5
[% END %]
6
[% USE KohaAuthorisedValues %]
6
[% USE AuthorisedValues %]
7
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
[% SET destination = "circ" %]
8
[% SET destination = "circ" %]
9
<title>Koha &rsaquo; Circulation
9
<title>Koha &rsaquo; Circulation
Lines 229-235 var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); Link Here
229
    [% IF ( itemtype_notforloan ) %]
229
    [% IF ( itemtype_notforloan ) %]
230
        Item type is normally not for loan.
230
        Item type is normally not for loan.
231
    [% ELSIF ( item_notforloan ) %]
231
    [% ELSIF ( item_notforloan ) %]
232
        [% item_notforloan_lib = KohaAuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
232
        [% item_notforloan_lib = AuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
233
        Item is normally not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
233
        Item is normally not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
234
    [% END %]
234
    [% END %]
235
        Check out anyway?
235
        Check out anyway?
Lines 362-368 var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); Link Here
362
            [% IF ( itemtype_notforloan ) %]
362
            [% IF ( itemtype_notforloan ) %]
363
                Item type not for loan.
363
                Item type not for loan.
364
            [% ELSIF ( item_notforloan ) %]
364
            [% ELSIF ( item_notforloan ) %]
365
                [% item_notforloan_lib = KohaAuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
365
                [% item_notforloan_lib = AuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
366
                Item not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
366
                Item not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
367
            [% END %]
367
            [% END %]
368
            </li>
368
            </li>
Lines 705-714 No patron matched <span class="ex">[% message %]</span> Link Here
705
        <span title="[% todayissue.dd_sort %]">[% todayissue.dd %]</span>
705
        <span title="[% todayissue.dd_sort %]">[% todayissue.dd %]</span>
706
706
707
            [% IF ( todayissue.itemlost ) %]
707
            [% IF ( todayissue.itemlost ) %]
708
                <span class="lost">[% KohaAuthorisedValues.GetByCode( 'LOST', todayissue.itemlost ) %]</span>
708
                <span class="lost">[% AuthorisedValues.GetByCode( 'LOST', todayissue.itemlost ) %]</span>
709
            [% END %]
709
            [% END %]
710
            [% IF ( todayissue.damaged ) %]
710
            [% IF ( todayissue.damaged ) %]
711
                <span class="dmg">[% KohaAuthorisedValues.GetByCode( 'DAMAGED', todayissue.damaged ) %]</span>
711
                <span class="dmg">[% AuthorisedValues.GetByCode( 'DAMAGED', todayissue.damaged ) %]</span>
712
            [% END %]
712
            [% END %]
713
        </td>
713
        </td>
714
        <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>
714
        <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>
Lines 792-801 No patron matched <span class="ex">[% message %]</span> Link Here
792
        <span title="[% previssue.dd_sort %]">[% previssue.dd %]</span>
792
        <span title="[% previssue.dd_sort %]">[% previssue.dd %]</span>
793
793
794
            [% IF ( previssue.itemlost ) %]
794
            [% IF ( previssue.itemlost ) %]
795
                <span class="lost">[% KohaAuthorisedValues.GetByCode( 'LOST', previssue.itemlost ) %]</span>
795
                <span class="lost">[% AuthorisedValues.GetByCode( 'LOST', previssue.itemlost ) %]</span>
796
            [% END %]
796
            [% END %]
797
            [% IF ( previssue.damaged ) %]
797
            [% IF ( previssue.damaged ) %]
798
                <span class="dmg">[% KohaAuthorisedValues.GetByCode( 'DAMAGED', previssue.damaged ) %]</span>
798
                <span class="dmg">[% AuthorisedValues.GetByCode( 'DAMAGED', previssue.damaged ) %]</span>
799
            [% END %]
799
            [% END %]
800
        </td>
800
        </td>
801
        <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>
801
        <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>
Lines 933-942 No patron matched <span class="ex">[% message %]</span> Link Here
933
            <span title="[% relissue.dd_sort %]">[% relissue.dd %]</span></td>
933
            <span title="[% relissue.dd_sort %]">[% relissue.dd %]</span></td>
934
934
935
            [% IF ( relissue.itemlost ) %]
935
            [% IF ( relissue.itemlost ) %]
936
                <span class="lost">[% KohaAuthorisedValues.GetByCode( 'LOST', relissue.itemlost ) %]</span>
936
                <span class="lost">[% AuthorisedValues.GetByCode( 'LOST', relissue.itemlost ) %]</span>
937
            [% END %]
937
            [% END %]
938
            [% IF ( relissue.damaged ) %]
938
            [% IF ( relissue.damaged ) %]
939
                <span class="dmg">[% KohaAuthorisedValues.GetByCode( 'DAMAGED', relissue.damaged ) %]</span>
939
                <span class="dmg">[% AuthorisedValues.GetByCode( 'DAMAGED', relissue.damaged ) %]</span>
940
            [% END %]
940
            [% END %]
941
        </td>
941
        </td>
942
        <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>
942
        <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>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-4 / +4 lines)
Lines 1-5 Link Here
1
[% USE KohaAuthorisedValues %]
2
[% USE Branches %]
1
[% USE Branches %]
2
[% USE AuthorisedValues %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Acquisitions  &rsaquo;
4
<title>Koha &rsaquo; Acquisitions  &rsaquo;
5
    [% IF ( op_save ) %]
5
    [% IF ( op_save ) %]
Lines 450-456 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
450
                [% ELSE %][% suggestion.suggestiontypelabel %][% END %]
450
                [% ELSE %][% suggestion.suggestiontypelabel %][% END %]
451
            [% ELSE %]
451
            [% ELSE %]
452
                [% IF ( suggestion.suggestiontype ) %]
452
                [% IF ( suggestion.suggestiontype ) %]
453
                    [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
453
                    [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %]
454
                [% ELSE %]
454
                [% ELSE %]
455
                    No name
455
                    No name
456
                [% END %]
456
                [% END %]
Lines 517-524 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
517
                        Rejected
517
                        Rejected
518
                    [% ELSIF ( suggestions_loo.CHECKED ) %]
518
                    [% ELSIF ( suggestions_loo.CHECKED ) %]
519
                        Checked
519
                        Checked
520
                    [% ELSIF KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
520
                    [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
521
                        [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
521
                        [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
522
                    [% END %]
522
                    [% END %]
523
523
524
                    [% IF ( suggestions_loo.reason ) %]
524
                    [% IF ( suggestions_loo.reason ) %]
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc (-2 / +2 lines)
Lines 1-4 Link Here
1
[% USE KohaAuthorisedValues %]
1
[% USE AuthorisedValues %]
2
2
3
[% IF ( item.itemlost ) %]
3
[% IF ( item.itemlost ) %]
4
    [% av_lib_include = KohaAuthorisedValues.GetByCode( 'LOST', item.itemlost, 1 ) %]
4
    [% av_lib_include = KohaAuthorisedValues.GetByCode( 'LOST', item.itemlost, 1 ) %]
Lines 33-39 Link Here
33
[% ELSIF ( item.notforloan_per_itemtype ) %]
33
[% ELSIF ( item.notforloan_per_itemtype ) %]
34
    Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
34
    Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
35
[% ELSIF ( item.damaged ) %]
35
[% ELSIF ( item.damaged ) %]
36
    [% av_lib_include = KohaAuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %]
36
    [% av_lib_include = AuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %]
37
    [% IF av_lib_include %]
37
    [% IF av_lib_include %]
38
        [% av_lib_include %]
38
        [% av_lib_include %]
39
    [% ELSE %]
39
    [% ELSE %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt (-3 / +2 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaAuthorisedValues %]
2
[% USE AuthorisedValues %]
3
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;
3
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;
4
[% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
4
[% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
5
[% IF ( op_else ) %]Purchase Suggestions[% END %]
5
[% IF ( op_else ) %]Purchase Suggestions[% END %]
Lines 213-219 Link Here
213
                    [% ELSIF ( suggestions_loo.ORDERED ) %]Ordered by the library
213
                    [% ELSIF ( suggestions_loo.ORDERED ) %]Ordered by the library
214
                    [% ELSIF ( suggestions_loo.REJECTED ) %]Suggestion declined
214
                    [% ELSIF ( suggestions_loo.REJECTED ) %]Suggestion declined
215
                    [% ELSIF ( suggestions_loo.AVAILABLE ) %]Available in the library
215
                    [% ELSIF ( suggestions_loo.AVAILABLE ) %]Available in the library
216
                    [% ELSE %] [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) %] [% END %]
216
                    [% ELSE %] [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) %] [% END %]
217
217
218
                    [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason %])[% END %]
218
                    [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason %])[% END %]
219
                </td>
219
                </td>
220
- 

Return to bug 10626