Bug 16443: Make C4::Members::Statistics plack safe

If the prefs is updated, the fields won't be.
To make sure we already fetch updated values, we should remove the
package variable and define it in the subroutine.

There is not test plan, just make sure the changes are consistent.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 29e402d398)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
Jonathan Druart 2016-05-04 20:08:53 +01:00 committed by Frédéric Demians
parent 6ff159e214
commit 93ffd58fe3
1 changed files with 1 additions and 4 deletions

View File

@ -40,10 +40,6 @@ BEGIN {
);
}
our $fields = get_fields();
=head2 get_fields
Get fields form syspref 'StatisticsFields'
Returns list of valid fields, defaults to 'location|itype|ccode'
@ -79,6 +75,7 @@ sub get_fields {
sub construct_query {
my $count = shift;
my $subquery = shift;
my $fields = get_fields();
my @select_fields = split '\|', $fields;
my $query = "SELECT COUNT(*) as count_$count,";
$query .= join ',', @select_fields;