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

(-)a/Koha/AuthorisedValue.pm (-4 / +7 lines)
Lines 67-81 sub opac_translated_description { Link Here
67
             : $self->lib;
67
             : $self->lib;
68
    }
68
    }
69
    $lang ||= C4::Languages::getlanguage;
69
    $lang ||= C4::Languages::getlanguage;
70
71
    return $self->translated_description unless $self->lib_opac;
72
70
    my $translated_description = Koha::Localizations->search({
73
    my $translated_description = Koha::Localizations->search({
71
        code => sprintf "%s_%s", $self->category, $self->authorised_value,
74
        code => sprintf( "%s_%s", $self->category, $self->authorised_value ),
72
        entity => 'authorised_values',
75
        entity => 'authorised_values',
73
        lang => $lang,
76
        lang => $lang,
74
        interface => 'opac',
77
        interface => 'opac',
75
    })->next;
78
    })->next;
76
    return $translated_description
79
    return $translated_description
77
         ? $translated_description->translation
80
         ? $translated_description->translation
78
         : $self->translated_description; # FIXME Is that what we really want?
81
         : $self->lib_opac;
79
}
82
}
80
83
81
=head3 translated_description
84
=head3 translated_description
Lines 94-100 sub translated_description { Link Here
94
    }
97
    }
95
    $lang ||= C4::Languages::getlanguage;
98
    $lang ||= C4::Languages::getlanguage;
96
    my $translated_description = Koha::Localizations->search({
99
    my $translated_description = Koha::Localizations->search({
97
        code => sprintf "%s_%s", $self->category, $self->authorised_value,
100
        code => sprintf( "%s_%s", $self->category, $self->authorised_value ),
98
        entity => 'authorised_values',
101
        entity => 'authorised_values',
99
        lang => $lang,
102
        lang => $lang,
100
    })->next;
103
    })->next;
Lines 111-117 sub translated_descriptions { Link Here
111
    my ( $self ) = @_;
114
    my ( $self ) = @_;
112
    my @translated_descriptions = Koha::Localizations->search(
115
    my @translated_descriptions = Koha::Localizations->search(
113
        {   entity => 'authorised_values',
116
        {   entity => 'authorised_values',
114
            code => sprintf "%s_%s", $self->category, $self->authorised_value,
117
            code => sprintf( "%s_%s", $self->category, $self->authorised_value ),
115
        }
118
        }
116
    );
119
    );
117
    return [ map {
120
    return [ map {
(-)a/t/db_dependent/AuthorisedValues.t (-6 / +6 lines)
Lines 4-9 use Modern::Perl; Link Here
4
use Test::More tests => 15;
4
use Test::More tests => 15;
5
5
6
use t::lib::TestBuilder;
6
use t::lib::TestBuilder;
7
use t::lib::Mocks;
7
8
8
use Koha::Database;
9
use Koha::Database;
9
use C4::Context;
10
use C4::Context;
Lines 214-227 subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { Link Here
214
            \@descriptions,
215
            \@descriptions,
215
            [
216
            [
216
                {
217
                {
217
                    authorised_value => '',
218
                    lib              => $av_empty_string->lib,
219
                    opac_description => $av_empty_string->lib_opac
220
                },
221
                {
222
                    authorised_value => $av_0->authorised_value,
218
                    authorised_value => $av_0->authorised_value,
223
                    lib              => $av_0->lib,
219
                    lib              => $av_0->lib,
224
                    opac_description => $av_0->lib_opac
220
                    opac_description => $av_0->lib_opac
221
                },
222
                {
223
                    authorised_value => '',
224
                    lib              => $av_empty_string->lib,
225
                    opac_description => $av_empty_string->lib_opac
225
                }
226
                }
226
            ],
227
            ],
227
        );
228
        );
228
- 

Return to bug 20307