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

(-)a/C4/Koha.pm (-3 / +4 lines)
Lines 1073-1085 by the passed category and code Link Here
1073
=cut
1073
=cut
1074
1074
1075
sub GetAuthorisedValueByCode {
1075
sub GetAuthorisedValueByCode {
1076
    my ( $category, $authvalcode ) = @_;
1076
    my ( $category, $authvalcode, $opac ) = @_;
1077
1077
1078
    my $field = $opac ? 'lib_opac' : 'lib';
1078
    my $dbh = C4::Context->dbh;
1079
    my $dbh = C4::Context->dbh;
1079
    my $sth = $dbh->prepare("SELECT lib FROM authorised_values WHERE category=? AND authorised_value =?");
1080
    my $sth = $dbh->prepare("SELECT $field FROM authorised_values WHERE category=? AND authorised_value =?");
1080
    $sth->execute( $category, $authvalcode );
1081
    $sth->execute( $category, $authvalcode );
1081
    while ( my $data = $sth->fetchrow_hashref ) {
1082
    while ( my $data = $sth->fetchrow_hashref ) {
1082
        return $data->{'lib'};
1083
        return $data->{ $field };
1083
    }
1084
    }
1084
}
1085
}
1085
1086
(-)a/Koha/Template/Plugin/KohaAuthorisedValues.pm (+32 lines)
Line 0 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
sub GetByCode {
28
    my ( $self, $category, $code, $opac ) = @_;
29
    return GetAuthorisedValueByCode( $category, $code, $opac );
30
}
31
32
1;
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc (-5 / +14 lines)
Lines 1-3 Link Here
1
[% USE KohaAuthorisedValues %]
2
1
[% IF ( item.datedue ) %]
3
[% IF ( item.datedue ) %]
2
    [% IF ( OPACShowCheckoutName ) %]
4
    [% IF ( OPACShowCheckoutName ) %]
3
        Checked out to [% item.cardnumber %] [% item.firstname %] [% item.surname %]
5
        Checked out to [% item.cardnumber %] [% item.firstname %] [% item.surname %]
Lines 12-21 Link Here
12
[% ELSIF ( item.wthdrawn ) %]
14
[% ELSIF ( item.wthdrawn ) %]
13
    Item withdrawn
15
    Item withdrawn
14
[% ELSIF ( item.itemlost ) %]
16
[% ELSIF ( item.itemlost ) %]
15
    [% IF ( item.lostimageurl ) %]
17
    [% IF KohaAuthorisedValues.GetByCode( 'LOST', item.itemlost, 1 ) %]
16
        <img src="[% item.lostimageurl %]" alt="[% item.lostimagelabel %]" title="[% item.lostimagelabel %]">
18
        [% KohaAuthorisedValues.GetByCode( 'LOST', item.itemlost, 1 ) %]
17
    [% ELSE %]
19
    [% ELSE %]
18
        Item lost
20
        [% IF ( item.lostimageurl ) %]
21
            <img src="[% item.lostimageurl %]" alt="[% item.lostimagelabel %]" title="[% item.lostimagelabel %]">
22
        [% ELSE %]
23
            Item lost
24
        [% END %]
19
    [% END %]
25
    [% END %]
20
[% ELSIF ( item.itemnotforloan ) %]
26
[% ELSIF ( item.itemnotforloan ) %]
21
    [% IF ( item.notforloanvalue ) %]
27
    [% IF ( item.notforloanvalue ) %]
Lines 26-32 Link Here
26
[% ELSIF ( item.notforloan_per_itemtype ) %]
32
[% ELSIF ( item.notforloan_per_itemtype ) %]
27
    Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
33
    Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
28
[% ELSIF ( item.damaged ) %]
34
[% ELSIF ( item.damaged ) %]
29
    Item damaged
35
    [% IF KohaAuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %]
36
        [% KohaAuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %]
37
    [% ELSE %]
38
        Item damaged
39
    [% END %]
30
[% ELSE %]
40
[% ELSE %]
31
    Available [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
41
    Available [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
32
[% END %]
42
[% END %]
33
- 

Return to bug 4173