Bug 14769: (QA follow-up) Remove global var $cached_indicators
commit32fc3f9ed14df5cec9e13064c93959fce8dec69c
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 12 Apr 2018 06:54:34 +0000 (12 08:54 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 12 Apr 2018 13:50:36 +0000 (12 10:50 -0300)
treefb599d6e5d85d891d35ccc8b3d06959fce7d2cfa
parent0ea53c745632e3b45bcad2d2238e4b126a323231
Bug 14769: (QA follow-up) Remove global var $cached_indicators

As requested by RM, this patch replaces using the global $cached_indicators
by saving state temporarily during the (limited) lifetime of the object.

Essentially this affects two places in code:
[1] blinddetail-biblio-search.pl (loading auth record in editor)
[2] AuthoritiesMarc::merge (merging authority into biblios)

Concurrent runs of [1] and/or [2] together with a simultaneous pref change
just in between could cause slight (hypothetical) side-effects.
The current approach of keeping state in the object makes that a series of
controlled_indicators calls during an immediate merge of one specific
authority is not affected by a simultaneous pref change. So the same rules
are applied to the set of attached biblio record for that authority.
Note also that the cron job ignores a simultaneous pref change, since
it reads from the unchanged L1 cache (yes, also hypothetical).

Test plan:
[1] Run t/Koha/Authority/ControlledIndicators.t
[2] Run t/db_dependent/Authority/Merge.t
[3] Run t/db_dependent/Koha/Authorities.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Authority/ControlledIndicators.pm
t/Koha/Authority/ControlledIndicators.t