Bug 16431: Use Koha::Cache to cache marc subfield structure
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 3 May 2016 13:34:33 +0000 (14:34 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 8 Jul 2016 12:44:58 +0000 (12:44 +0000)
commit172ebfe520d34f8106ec011b7d707c0560d65760
tree67087827e501d298bc7a9438c9d7874fe9713f7c
parent1509322c9a813809ca453b476ea1163bbc9303ca
Bug 16431: Use Koha::Cache to cache marc subfield structure

The marc subfield structure is currently cached using a global variable
of C4::Context. The infos are retrieved every time a new context is
created.
This patch suggests to use Koha::Cache instead.

To achieve this goal, a new subroutine is created
C4::Biblio::GetMarcSubfieldStructure, it will be called from code which
needs to get the marc subfield structure. GetMarcFromKohaField,
GetMarcSubfieldStructureFromKohaField, TransformKohaToMarc and
_get_inverted_marc_field_map are modified accordingly and the cache is cleared
when the table is updated (from the 3 pl scripts modified by this patch).

The caching done in C4::Context (marcfromkohafield) is removed.

Test plan:
Play with the marc subfield structure (in the administration module),
then add and edit records and make sure everything went fine.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Everything works as expected on my functional tests. I'm really happy to see the
patch introduces relevant tests for previously untested functions.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/AuthoritiesMarc.pm
C4/Biblio.pm
C4/Context.pm
admin/biblio_framework.pl
admin/marc_subfields_structure.pl
admin/marctagstructure.pl
t/db_dependent/Biblio.t
t/db_dependent/Items.t