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

(-)a/C4/Biblio.pm (-10 / +9 lines)
Lines 99-104 use C4::Linker; Link Here
99
use C4::OAI::Sets;
99
use C4::OAI::Sets;
100
100
101
use Koha::Logger;
101
use Koha::Logger;
102
use Koha::Cache::Memory::Lite;
102
use Koha::Caches;
103
use Koha::Caches;
103
use Koha::ClassSources;
104
use Koha::ClassSources;
104
use Koha::Authority::Types;
105
use Koha::Authority::Types;
Lines 1469-1485 sub GetAuthorisedValueDesc { Link Here
1469
1470
1470
        #---- itemtypes
1471
        #---- itemtypes
1471
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1472
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1472
            my $lang = C4::Languages::getlanguage;
1473
            my $memory_cache = Koha::Cache::Memory::Lite->get_instance();
1473
            $lang //= 'en';
1474
            my $cache_key = 'GetAuthorisedValueDesc:itemtypes';
1474
            $cache_key = 'itemtype:description:' . $lang;
1475
            my $itemtypes = $memory_cache->get_from_cache($cache_key);
1475
            my $itypes = $cache->get_from_cache( $cache_key, { unsafe => 1 } );
1476
            unless ($itemtypes) {
1476
            if ( !$itypes ) {
1477
                $itemtypes = { map { $_->itemtype => $_ } Koha::ItemTypes->as_list };
1477
                $itypes =
1478
                $memory_cache->set_in_cache($cache_key, $itemtypes);
1478
                  { map { $_->itemtype => $_->translated_description }
1479
                      Koha::ItemTypes->search()->as_list };
1480
                $cache->set_in_cache( $cache_key, $itypes );
1481
            }
1479
            }
1482
            return $itypes->{$value};
1480
            my $itemtype = $itemtypes->{$value};
1481
            return $itemtype ? $itemtype->translated_description : undef;
1483
        }
1482
        }
1484
1483
1485
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "cn_source" ) {
1484
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "cn_source" ) {
(-)a/t/db_dependent/Koha/Filter/ExpandCodedFields.t (-1 / +2 lines)
Lines 68-77 subtest 'ExpandCodedFields tests' => sub { Link Here
68
    $cache->clear_from_cache("MarcCodedFields-");
68
    $cache->clear_from_cache("MarcCodedFields-");
69
    # Clear GetAuthorisedValueDesc-generated cache
69
    # Clear GetAuthorisedValueDesc-generated cache
70
    $cache->clear_from_cache("libraries:name");
70
    $cache->clear_from_cache("libraries:name");
71
    $cache->clear_from_cache("itemtype:description:en");
72
    $cache->clear_from_cache("cn_sources:description");
71
    $cache->clear_from_cache("cn_sources:description");
73
    $cache->clear_from_cache("AV_descriptions:" . $av->category);
72
    $cache->clear_from_cache("AV_descriptions:" . $av->category);
74
73
74
    Koha::Caches->get_instance('localization')->clear_from_cache('Itemtype:en');
75
75
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
76
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
76
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
77
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
77
    $record = $biblio->metadata->record;
78
    $record = $biblio->metadata->record;
(-)a/t/db_dependent/Koha/Item.t (-5 / +8 lines)
Lines 1934-1943 subtest 'columns_to_str' => sub { Link Here
1934
    $cache->clear_from_cache("MarcStructure-1-");
1934
    $cache->clear_from_cache("MarcStructure-1-");
1935
    $cache->clear_from_cache("MarcSubfieldStructure-");
1935
    $cache->clear_from_cache("MarcSubfieldStructure-");
1936
    $cache->clear_from_cache("libraries:name");
1936
    $cache->clear_from_cache("libraries:name");
1937
    $cache->clear_from_cache("itemtype:description:en");
1938
    $cache->clear_from_cache("cn_sources:description");
1937
    $cache->clear_from_cache("cn_sources:description");
1939
    $cache->clear_from_cache("AV_descriptions:LOST");
1938
    $cache->clear_from_cache("AV_descriptions:LOST");
1940
1939
1940
    Koha::Caches->get_instance('localization')->clear_from_cache('Itemtype:en');
1941
1941
    # Creating subfields 'é', 'è' that are not linked with a kohafield
1942
    # Creating subfields 'é', 'è' that are not linked with a kohafield
1942
    Koha::MarcSubfieldStructures->search(
1943
    Koha::MarcSubfieldStructures->search(
1943
        {
1944
        {
Lines 2018-2027 subtest 'columns_to_str' => sub { Link Here
2018
    $cache->clear_from_cache("MarcStructure-1-");
2019
    $cache->clear_from_cache("MarcStructure-1-");
2019
    $cache->clear_from_cache("MarcSubfieldStructure-");
2020
    $cache->clear_from_cache("MarcSubfieldStructure-");
2020
    $cache->clear_from_cache("libraries:name");
2021
    $cache->clear_from_cache("libraries:name");
2021
    $cache->clear_from_cache("itemtype:description:en");
2022
    $cache->clear_from_cache("cn_sources:description");
2022
    $cache->clear_from_cache("cn_sources:description");
2023
    $cache->clear_from_cache("AV_descriptions:LOST");
2023
    $cache->clear_from_cache("AV_descriptions:LOST");
2024
2024
2025
    Koha::Caches->get_instance('localization')->clear_from_cache('Itemtype:en');
2026
2025
    $schema->storage->txn_rollback;
2027
    $schema->storage->txn_rollback;
2026
};
2028
};
2027
2029
Lines 2038-2047 subtest 'strings_map() tests' => sub { Link Here
2038
    $cache->clear_from_cache("MarcStructure-1-");
2040
    $cache->clear_from_cache("MarcStructure-1-");
2039
    $cache->clear_from_cache("MarcSubfieldStructure-");
2041
    $cache->clear_from_cache("MarcSubfieldStructure-");
2040
    $cache->clear_from_cache("libraries:name");
2042
    $cache->clear_from_cache("libraries:name");
2041
    $cache->clear_from_cache("itemtype:description:en");
2042
    $cache->clear_from_cache("cn_sources:description");
2043
    $cache->clear_from_cache("cn_sources:description");
2043
    $cache->clear_from_cache("AV_descriptions:LOST");
2044
    $cache->clear_from_cache("AV_descriptions:LOST");
2044
2045
2046
    Koha::Caches->get_instance('localization')->clear_from_cache('Itemtype:en');
2047
2045
    # Recreating subfields just to be sure tests will be ok
2048
    # Recreating subfields just to be sure tests will be ok
2046
    # 1 => av (LOST)
2049
    # 1 => av (LOST)
2047
    # 3 => no link
2050
    # 3 => no link
Lines 2224-2232 subtest 'strings_map() tests' => sub { Link Here
2224
    $cache->clear_from_cache("MarcStructure-1-");
2227
    $cache->clear_from_cache("MarcStructure-1-");
2225
    $cache->clear_from_cache("MarcSubfieldStructure-");
2228
    $cache->clear_from_cache("MarcSubfieldStructure-");
2226
    $cache->clear_from_cache("libraries:name");
2229
    $cache->clear_from_cache("libraries:name");
2227
    $cache->clear_from_cache("itemtype:description:en");
2228
    $cache->clear_from_cache("cn_sources:description");
2230
    $cache->clear_from_cache("cn_sources:description");
2229
2231
2232
    Koha::Caches->get_instance('localization')->clear_from_cache('Itemtype:en');
2233
2230
    $schema->storage->txn_rollback;
2234
    $schema->storage->txn_rollback;
2231
};
2235
};
2232
2236
2233
- 

Return to bug 38136