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

(-)a/Koha/AuthorisedValues.pm (+1 lines)
Lines 134-139 sub get_description_by_koha_field { Link Here
134
    return $cached if $cached;
134
    return $cached if $cached;
135
135
136
    my $av = $self->find_by_koha_field($params);
136
    my $av = $self->find_by_koha_field($params);
137
    return {} unless defined $av;
137
    my $descriptions = { lib => $av->lib, opac_description => $av->opac_description };
138
    my $descriptions = { lib => $av->lib, opac_description => $av->opac_description };
138
    $memory_cache->set_in_cache( $cache_key, $descriptions );
139
    $memory_cache->set_in_cache( $cache_key, $descriptions );
139
    return $descriptions;
140
    return $descriptions;
(-)a/t/db_dependent/AuthorisedValues.t (-2 / +6 lines)
Lines 174-180 subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { Link Here
174
        is( $av, undef, );
174
        is( $av, undef, );
175
    };
175
    };
176
    subtest 'get_description_by_koha_field' => sub {
176
    subtest 'get_description_by_koha_field' => sub {
177
        plan tests => 3;
177
        plan tests => 4;
178
        my $descriptions;
178
        my $descriptions;
179
179
180
        # Test authorised_value = 0
180
        # Test authorised_value = 0
Lines 199-204 subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { Link Here
199
        $descriptions = Koha::AuthorisedValues->get_description_by_koha_field(
199
        $descriptions = Koha::AuthorisedValues->get_description_by_koha_field(
200
            { kohafield => 'items.restricted', authorised_value => undef } );
200
            { kohafield => 'items.restricted', authorised_value => undef } );
201
        is_deeply( $descriptions, {}, ) ;    # This could be arguable, we could return undef instead
201
        is_deeply( $descriptions, {}, ) ;    # This could be arguable, we could return undef instead
202
203
        # No authorised_value
204
        $descriptions = Koha::AuthorisedValues->get_description_by_koha_field(
205
            { kohafield => 'items.restricted', authorised_value => "does not exist" } );
206
        is_deeply( $descriptions, {}, ) ;    # This could be arguable, we could return undef instead
202
    };
207
    };
203
    subtest 'get_descriptions_by_koha_field' => sub {
208
    subtest 'get_descriptions_by_koha_field' => sub {
204
        plan tests => 1;
209
        plan tests => 1;
205
- 

Return to bug 17642