From 8d3bb4ebc1993702808e0367b5e8c0df02bbeed1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 26 Oct 2015 13:59:06 +0000 Subject: [PATCH] Bug 14778: Make Search.t pass - replace SHOW COLUMNS For an unkown reason, when executed from a test file, the 'SHOW COLUMNS' statement does not return anything. We need to retrieve the column list from the DBIx::Class resultset. --- C4/Search.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index e0f34bf..1a8bba0 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1889,10 +1889,9 @@ sub searchResults { my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber", "" ); ## find column names of items related to MARC - my $sth2 = $dbh->prepare("SHOW COLUMNS FROM items"); - $sth2->execute; my %subfieldstosearch; - while ( ( my $column ) = $sth2->fetchrow ) { + my @columns = Koha::Database->new()->schema()->resultset('Item')->result_source->columns; + for my $column ( @columns ) { my ( $tagfield, $tagsubfield ) = &GetMarcFromKohaField( "items." . $column, "" ); if ( defined $tagsubfield ) { -- 2.1.0