From 2eb6847d1c7f60c63186a677ad14651e088a07d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Wed, 27 Apr 2016 12:38:58 +0200 Subject: [PATCH] Bug 12721: (followup) Replace mysqlism by DBIx::Class This patch removes the mysqlism (see comment #18) --- C4/Members/Statistics.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/C4/Members/Statistics.pm b/C4/Members/Statistics.pm index c491819..9ca801e 100644 --- a/C4/Members/Statistics.pm +++ b/C4/Members/Statistics.pm @@ -59,14 +59,11 @@ sub get_fields { if ( $syspref ) { my @ret; my @spfields = split ('\|', $syspref); - my $dbh=C4::Context->dbh; - my $sth = $dbh->prepare('SHOW COLUMNS FROM items'); - $sth->execute; - my $dbfields = $sth->fetchall_hashref('Field'); - $sth->finish(); + my $schema = Koha::Database->new()->schema(); + my @columns = $schema->source('Item')->columns; foreach my $fn ( @spfields ) { - push ( @ret, $fn ) if ( $dbfields->{ $fn } ); + push ( @ret, $fn ) if ( grep(/^$fn$/, @columns) ); } $ret = join( '|', @ret); } -- 1.7.10.4