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)
committerFrédéric Demians <f.demians@tamil.fr>
Mon, 1 Aug 2016 08:34:57 +0000 (10:34 +0200)
commit39838698a15bb3397647c5fdb358e14b8c13e441
tree04d443078e310c1db7f2a125ac7bdf5eb281f4d7
parentca08a21e4e8f3a24e636a47eddfab464352b6418
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>
(cherry picked from commit 172ebfe520d34f8106ec011b7d707c0560d65760)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
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